Re:Why-did-you-update – Warnings about unnecessary React upd...
by grovesNL on Wednesday April 19, 2017 @01:25PM
(#14149656)
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.p...
[ Parent
| on HN ]
Re:Why-did-you-update – Warnings about unnecessary React upd...
by acemarke on Wednesday April 19, 2017 @01:51PM
(#14149969)
Which 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".