useMemo and Derived Values
Do not store in state what you can calculate from other state. Compute it during render. For expensive work, useMemo remembers the result until its inputs change.
Examplereact
matches is derived from query. There is no separate matches state to keep in sync.
Quick check
What is "derived state"?
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.