Code Monkey home page Code Monkey logo

rssfeeder's Introduction

RSS Feeder

A React, Typescript App for displaying RSS feed of a given URL.

Getting started

Command Description
yarn install Install all dependencies
yarn start Starts dev server
yarn test run test cases in watch mode
yarn coverage run tests and coverage

App structure

  • App maintains following localstate

    AppStateType = {
      error: boolean;
      errorMsg: string;
      feed: FeedType[];
      isLocked: boolean;
      page: number;
      rssURL: string;
    };
    
    error - Flag to show/hide error notification
    errorMsg - the error message
    feed - holds the array of fetched feed.
    isLocked - disables form submission.
    page - The current active displayed page
    rssURL - The URL entry in the searchbox
    

    The App starts with blank URL and empty feed. The input box is type="URL" so as to make use of native HTML5 validations. Once the form is submitted the submission is locked until there is a change in rssURL. Form submission invokes getRSS. getRSS fetches feed from remote (or via dev-server to avoid CORS). handleResponse pushes feed in App state or invokes error notification in case of error. Setting App state re-renders the component. The Feed component does not receive the complete feed, but only the feed which needs to be shown, this is handled by getCurrentFeed.

  • Form - Functional component, creates searchbox with submit button

  • Feed - Functional component, displays the feeds in form of UL LI

  • Pagination - Functional component, Create the notification section.

  • Notification - Functional component, creates notification.

Performance

  • The main App component is pure component and all others are Stateless functional components
  • Memoization is used in all stateless components to avoid any unnecessary re-renders.

Assumptions

  • Basic desktop/non-responsive UI required.
  • Modern browser considered.

Enhancements

  • Data is fetched from remote, adding a loader would be good.
  • There is basic HTML validations in Searchbox, adding some custom validation will help.
  • There can be better error handling in getRSS rather than generic no feeds found msg.
  • A few plugins can be added to webpack for optimizing production code like uglifyjs-webpack-plugin.
  • The App.css houses all the CSS rules, this can be split.
  • UI can be improved.

rssfeeder's People

Contributors

dependabot[bot] avatar tsl143 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.