1
votes

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

2

2 Answers

1
votes

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.

2
votes

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.