3 ms·
You don't need to write shallow equality checks on each component if you're treating props/state as immutable. You can use React's PureComponent which automatic
by grovesNL 9y ago
You don't need to write shallow equality checks on each component if you're treating props/state as immutable. You can use React's PureComponent which automatically does this for you: https://facebook.github.io/react/docs/react-api.html#react.purecomponent https://facebook.github.io/react/docs/react-api.html#react.p...
- acemarke 9y agoWhich does the exact kind of shallow equality checks I was just describing :) The point is that for shallow equality checks to work properly, you do have to handle data immutably - such as using `someArray.concat(item)` instead of `someArray.push(item)`, because otherwise passing in the same references is interpreted as "nothing as changed".