aweary / react-copy-write

✍️ Immutable state with a mutable API
MIT License
1.79k stars 54 forks source link

Simplify ConsumerMemoization update logic #51

Closed mfix22 closed 6 years ago

mfix22 commented 6 years ago

Uses React's key prop to trigger updates. Would love to learn why this might be a bad idea 🙂

aweary commented 6 years ago

Hey @mfix22! Thanks for this. When you change the key on a component it causes the component to be completely unmounted and then mounted again. This would be much more expensive than the extra check in shouldComponentUpdate, so even if this is less complex it would be overall slower.

I Appreciate the PR though!

mfix22 commented 6 years ago

Yes! Thanks for that @aweary 👍