A list component keeps filteredRows in state and updates it in an effect whenever props.rows or query changes. The filter is fast and synchronous. Explain why a render can show the previous results and what you would change.
The component first renders using the old filteredRows, then the effect runs after commit and schedules another render. The filtered list is a pure function of rows and query, so compute it in render instead of storing a second source of truth. Consider memoizing only if the calculation is measurably expensive.
What a Strong Answer Covers
Identify the extra render caused by storing derived state.
Keep rows and query as inputs and calculate the list during render.
Follow-up Interview Question · Would a user-editable draft initialized from props be the same situation?