Reputation: 1541
In pure React I can pass props to child component and it re-renders. I would like to have the same functionality in Redux as well.
I want to have a component that is connected to Redux store and whenever the store updates (ideally select elements in store), the component is re-rendered (thus not directly dispatching an action). How can I achieve this in Redux?
Thanks
Upvotes: 2
Views: 209
Reputation: 7593
Why do so few read the docs?
If you did, you'd find that Redux creator Dan Abramov provides a great introduction into Redux with his Getting started with Redux video tutorials linked from the Redux GitHub page.
Videos 24-26 (there are 30 in total, averaging 3 minutes a piece) Dan does a great job of explaining what you are asking for.
I'd recommend watching the whole series from the start because it provides a great foundation about the inner workings of Redux that are a useful lead up to the use of the (helper) library React-Redux in the later videos.
Upvotes: 3
Reputation: 67469
The official React-Redux library provides this capability, with a method called connect
that generates store-connected wrapper components. Please see the Usage with React section in the Redux docs.
Upvotes: 2