2 ms·
Contrary to what a lot of people say, useMemo is more than a performance optimization. If React decides to create a new instance of a component because it thi
by PaulHoule 2y ago
Contrary to what a lot of people say, useMemo is more than a performance optimization.
If React decides to create a new instance of a component because it thinks a parameter change happened all the state in that component can get dumped which can have effects like a bunch of selections in a combo box disappearing.
- SebastianKra 2y agoThis does not happen. If you're losing state, it's always either because A: the component is replaced with another, B: the component is removed, C: you have given this component a key and changed it. From your example, I think you've assigned bad keys, or forgot to assign keys (for which the linter will scream at you)