Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with same props in shouldComponentUpdate

See original GitHub issue

I’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:closed
  • Created 8 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

Anahkiasencommented, Jun 15, 2016

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

gaearoncommented, Aug 9, 2015

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found