Answer the question
In order to leave comments, you need to log in
How is the DOM redrawn when used with Redux?
Pure React uses setState().
How is the DOM redrawn when used with Redux?
Answer the question
In order to leave comments, you need to log in
In general, a component's render method is called when state / props changes.
No one (not even the creator of the Redux library) asks you to drop state. This is a nice and handy "feature" of components in react.
When you include redux, you are wrapping your entire application in a Provider (with a store specified, of course ). Then the Provider passes where it needs to (depending on your "connected" components via the connect function) the necessary props . As new props arrive, the render method is called and the component is re-rendered.
You can verify all this if you look at your correct redux application through React Dev Tools in the browser console. You'll see a Provider nested at the very top with a bunch of data. Then down the tree, you'll find your components wrapped in connect(Component). There is no magic here.
Redrawing depends not only on light, but also on props. Well, besides, nothing prevents you from managing the state from the editor. I think it depends on the situation.
https://github.com/reactjs/react-redux/blob/v5.0.3...
https://github.com/reactjs/react-redux/blob/v5.0.3...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question