individual components should be connected to the store instead of just a few,


individual components should be connected to the store instead of just a few,



"Redux may not be as efficient out of the box when compared to other libraries. For maximum rendering performance in a React application, state should be stored in a normalized shape, many individual components should be connected to the store instead of just a few"
I read this on https://redux.js.org/faq/performance



The question is why "many individual components should be connected to the store instead of just a few" help improve performance ?



I always try to minimize accessing to redux store by reduce connected Component , does it right ?





Yes, example to avoid to re render a Parent component for refresh a Child component it is usefull to directely connect the Child ... and many other reasons
– N.Safi
Jul 2 at 14:22




1 Answer
1



You really don't need to worry about it now.



Build your app in the best way you think, with best practices and properly designed and you could easily improve along the way.



With that said if you are having this case of components passing props:


MainComp > ContentAreaComp > TopAreaComp > .... > GotPropFromMainComp



so it may be better to just create GotPropFromMainCompContainer for GotPropFromMainComp and save all of the props flow from top to bottom.


GotPropFromMainCompContainer


GotPropFromMainComp



You could improve your app by implementing shouldComponentUpdate for your components and use Stateless Components


shouldComponentUpdate


Stateless Components



But again, don't worry about it now unless you have a huge app now :)





Yeah, I already know container approach. My app is not huge yet, but will grow in future. Beside that, I just want to know if I understand wrong redux.
– duy bui
Jul 2 at 15:03






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages