2 ms·
This. The article would be completely contentless if not for pointing out the genuine pain that is JS object equality (the issue is that this is a JS pain and
by lucideer 7y ago
This.
The article would be completely contentless if not for pointing out the genuine pain that is JS object equality (the issue is that this is a JS pain and not a React pain: hooks just makes it more apparent).
The only thing I'll say is that battling with this pain has tended toward my inventing less generalised but more readable/maintainable/elegant solutions to most individual problems where I've encountered it. e.g.:
- object equality would solve this problem easily :(
- maybe I should've enforced strict immutables throughout?
- oh maybe I could approach it differently. Yes, let's try solution X
- hmm solution X isn't very reusable but it sure is clear and intuitive to read