Include forceUpdate in shouldUpdate()
infinnie opened this issue · 2 comments
infinnie commented
We sometimes want to write the shouldComponentUpdate()
function like this:
shouldComponentUpdate() {
requestAnimationFrame(this.forceUpdate.bind(this));
return false;
}
So maybe a reference to the forceUpdate
method should be passed to the shouldUpdate
property, or why is this approach wrong?
swyxio commented
interesting use case. i have added this in my clone: https://github.com/sw-yx/react-classless/blob/master/src/components/index.tsx#L53
hnordt commented
I think shouldComponentUpdate
should be pure. I'm not sure.