Coder Social home page Coder Social logo

react-burger's Introduction

Introduction

This is a demo project to familiarize the concept of using react, the project includes

  • setting up of eslint, prettier
  • connecting to a backend(Firebase)
  • authentication(token)
  • Redux for state management, redux-thunk(async actions)
  • Hooks for react v16.8 and above
  • lazyloading components

#Code style

  1. Setting up ESlint, prettier, gitignore
  2. do not eject from CRA
  3. always use destructuring
  4. Focus on creating functional component and useEffect hooks, do not use class based components
  5. Think about rerendering and use useEffect to reduce unnecessary re-rendering.
  6. Maintain as many stateless component as much as possible, but do not fall into props chaining hell
  7. Preference of async/await over .then and .catch
  8. Root Path should fall in a PATH constants file
  9. Store Persistent state and Client State(authenticated state etc.) in redux., Local UI state to pass down through component props. Do not abuse redux, if we're handling user input, onChangeHandler should use local state.
  10. all async code/data formatting should fall in sagas(Anticorruption Layer), redux should deal with the logic, action creator should deal with taking inputs and dispatching

#Things to do

  • guard the route(if user access through URL instead of normal button clicks)
  • refresh token on each HTTP request, using refresh token
  • load the token from localstorage if available

react-burger's People

Contributors

brlala avatar

Watchers

James Cloos 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.