You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, architecturally, use selectors to pull data from the store instead of directly doing it from mapStateToProps
Then consider using something like reselect for computed values. You only need reselect for computed values as non-computed values are already optimized by react-redux. However there are some complications with reselect depending on how you want to use it.
I think using the prefix select... makes sense. eg. selectLibrary, but willing to consider other naming conventions like getLibrary or librarySelector
re-reselect does seem to get around some of those annoyances I mentioned above. Read through some of the examples to see how it abstracts away the stupid code
First, architecturally, use selectors to pull data from the store instead of directly doing it from
mapStateToProps
Then consider using something like reselect for computed values. You only need reselect for computed values as non-computed values are already optimized by react-redux. However there are some complications with reselect depending on how you want to use it.
I think using the prefix
select...
makes sense. eg.selectLibrary
, but willing to consider other naming conventions likegetLibrary
orlibrarySelector
Readings:
https://medium.com/@matthew.holman/what-is-a-redux-selector-a517acee1fe8
https://read.reduxbook.com/markdown/part1/07-selectors.html
https://twitter.com/dan_abramov/status/664581975764766721?lang=en
https://medium.com/@kylpo/redux-best-practices-eef55a20cc72
https://medium.com/@parkerdan/react-reselect-and-redux-b34017f8194c
https://medium.com/@pearlmcphee/selectors-react-redux-reselect-9ab984688dd4
https://redux.js.org/recipes/computing-derived-data#selectors-todoselectorsjs
https://tech.residebrokerage.com/how-we-reselect-and-you-can-to-7e7ed23a8c6f
https://blog.isquaredsoftware.com/2017/12/idiomatic-redux-using-reselect-selectors/
https://github.com/toomuchdesign/re-reselect
and some redux optimization guides
https://spin.atomicobject.com/2018/04/02/redux-rerendering/
https://itnext.io/redux-ruins-you-react-app-performance-you-are-doing-something-wrong-82e28ec96cf5
https://medium.com/voobans-tech-stories/5-ways-to-stop-wasting-renders-in-react-redux-73b3c5d86f50
The text was updated successfully, but these errors were encountered: