Issue with same props in shouldComponentUpdate
See original GitHub issueI’m having an issue with Redux, when I try to implement shouldComponentUpdate
for a dumb component, this.props
already holds the same value as nextProps
. I read this was an issue linked with Flux architectures which I’m using Redux for, but I don’t understand why this would happen. Is there any way around it?
Issue Analytics
- State:
- Created 8 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Why in shouldComponentUpdate() nextProps and this.props ...
In your App.js, all the methods(may it be this.nameChange or this.typeChange) are changing the values on the same state.form object.
Read more >Using shouldComponentUpdate() · react-indepth
The shouldComponentUpdate() method is the first real life cycle optimization method that we can leverage in React. We can look at our current...
Read more >Hooks FAQ - React
Do Hooks replace render props and higher-order components? ... If there's something missing in this documentation, raise an issue and we'll try to...
Read more >Advanced Performance | React
When a component's props or state change, React decides whether an actual DOM update is necessary by constructing a new virtual DOM and...
Read more >What does "shouldComponentUpdate" do and why is it ...
Syntax: · Parameters: It accepts two parameters named nextProps and nextState. · Return Value: · Creating React Application: · Project Structure: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Basically my prop was mutable so as soon as it was mutated, both the previous and next props actually pointed to the same object, having the same values. I switched to using Immutable.js for objects
I’m not sure what you mean. If you don’t mutate Redux state and always return the new state (that’s how you should do in Redux), you shouldn’t have such problem. Can you show your code?