Interview practice question
Storing values that could be calculated
Frontend Engineering · React · Beginner
A component stores fullName in state and updates it with an effect whenever firstName or lastName changes. What's wrong?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Derived state duplicated.
- Effect causes extra render, risk of sync bugs.
- Compute during render.
- useMemo only if expensive.
- Single source of truth.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.