Re:Things to learn in React before using Redux
by acemarke on Thursday July 20, 2017 @11:55AM
(#14813569)
Yep, absolutely. See the Redux FAQ entry on "connecting multiple components" for more info [0] . I also discussed how connecting more components affects performance in my blog post "Practical Redux, Part 6 - Connected Lists, Forms, and Performance" [1], and there's many additional articles that discuss connected components and performance concerns as well [2].
[0] http://redux.js.org/docs/faq/ReactRedux.html#react-multiple-...
[1] http://blog.isquaredsoftware.com/2017/01/practical-redux-par...
[2] https://github.com/markerikson/react-redux-links/blob/master...
Re:Things to learn in React before using Redux
by prance on Thursday July 20, 2017 @06:28PM
(#14816802)
I don't agree with the view that a component doesn't need a prop "itself" if it "only" passes it on to a child component. That child component is a part of the parent. If one decided that e.g. the child is too simple to warrant to be its own component and inlined its render() content in the parent instead, suddenly its used props would be needed by the parent "itself".
Another thing to consider is that one tightly couples components to stores when connecting. So reusability of these components is hampered.
Re:Things to learn in React before using Redux
by pedalpete on Thursday July 20, 2017 @07:36PM
(#14817081)
If was my understanding that if a component has a prop which changes, even if that prop is passed down the tree, the component will still update.
This is one way I use redux, the connector watches for changes in state and then updates the component directly, rather than passing props down the tree.
Components only receiving props that they themselves need has kept things clean in our massive codebase, and allows you to effortlessly move things about and easily re-use components wherever it makes sense.