Skip to content

Instantly share code, notes, and snippets.

@stereobooster
Last active November 17, 2017 23:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save stereobooster/11e93716738a08b2bbeaea0be7ef99df to your computer and use it in GitHub Desktop.

Redux

  • Use Smart and Dumb Components (Know More)
  • Don't connect every component with the store which needs data from the store. Try to use pass data via props.
  • Take care in how you are storing the data in your store or else you will end up with a store with too many keys lying around, which simply becomes difficult to make sense.
  • Put things like different reducers, actions, selectors, etc in their own files for better separation of concerns.
  • Use solid redux libraries like redux-saga for async requests, redux-form for form handling, etc.
  • Dan Abramov, creator of redux has a free course which also explains a lot of best practices to use redux.

Normalizr

Use it only when JSON API response has deeply nested data and it is difficult for you to retrieve the nested data from the store. If your API response has one level or no nesting, you don't need normalization.

Reselect

Use this when your components have similar data requirements so that you can use share selectors between different components or you have complex selector which will be executed multiple times, because reselect automatically memoizes all selectors so that if the same input is given to the selector, it will not run the function again instead will give the cached output.

other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment