Loading…
A short voice session: one question, one follow-up, then instant feedback — up to 5 minutes.
Measure what re-renders on each keystroke, keep the input state local, defer or debounce the expensive filtering, and memoize or virtualize the list.
First profile with the React DevTools Profiler to see whether the lag comes from rendering the list, from the filtering calculation or from a parent re-rendering too much. Keep the input's state close to the input so typing does not re-render the whole page. Let the input update immediately and run the expensive part later: useDeferredValue renders the list with a lagging copy of the query, while debouncing delays work or network requests until typing pauses. Memoize the filtered result, wrap list rows in React.memo with stable props, and virtualize the list if it renders thousands of rows.