React·100 questions

What is derived state and why is it harmful?

Answer
Derived state is when state duplicates a computed value.
It leads to desynchronization.
It's better to compute via useMemo or directly in render.
Store the source of truth once.
Exception — when you need to 'fix' a value in time.
Was this answer helpful?

More questions in this topic

Related questions from other topics