What React Profiling Taught Me About Memoization
A React page felt slow after a new filter panel landed. I used the Profiler to find the real rerender, then simplified the component instead of adding hooks.


While working on a Next.js dashboard for Current Tribune, I noticed a small delay every time I changed a filter. It was not a dramatic failure. The page still worked, the request finished normally, and the browser did not freeze. But the filter input felt sticky, especially when the article list was already populated. My first instinct was the familiar one: add useMemo and useCallback around the obvious pieces. That instinct was only partly right.
The first fix looked more convincing than it was
The page had grown into one large client component. It owned the filter state, the selected category, the article list, several loading flags, and a few controls for changing publication status. The article rows were rendered from a derived array, so I wrapped that filtering and sorting work in useMemo. Then I wrapped the event handlers in useCallback because the row component received them as props.
Nothing was technically broken in that change. The dependency arrays were valid, and the code passed the usual checks. The problem was that I had not established whether filtering the list was the expensive part. I had simply chosen the most visible calculation and added a performance-looking solution.
There was also a practical cost. A handler that depended on the selected category now needed that category in its dependency array. A memoized value depended on several filter fields. Every future edit to the component meant checking whether those arrays were still correct. The code became more cautious without becoming easier to understand.
I spent longer than I should have trying to make the hook-heavy version feel justified. Then I opened React DevTools Profiler and recorded the interaction properly instead of guessing from the code.
The rerender was happening above the list
The profile changed the direction of the work. The filter calculation was not especially expensive for the amount of data on the page. The larger problem was the component boundary. Updating a text input changed state near the top of the page, which caused the toolbar, summary area, list container, and every article row to participate in the render path.
My first attempt at fixing that was another wrong turn. I added React.memo to the row component and expected the profiler to show an immediate improvement. It did reduce some child work, but the result was not as clean as I expected. One of the props was an object created during each render, so the memoized row still received a new reference. I had optimized the child while continuing to recreate one of its inputs.
That was a useful annoyance. It showed me that memoization was not a switch I could turn on at the leaves of the tree. The references, state ownership, and component structure all had to support it. Otherwise I was adding comparisons and mental overhead around a component that still had reasons to update.
The simpler change was to move the input state closer to the filter controls. The list no longer needed to rerender for every character typed into an unrelated search field. I also split the large component into a filter panel, a result summary, and an article list. That was a more meaningful optimization than the first round of hooks because it removed work from the update path instead of trying to disguise it.
Where useMemo and useCallback stayed
I did not remove every memoization hook. I removed the ones that existed only because a value was derived, not because the derivation was costly or because a stable reference was needed by a child that could benefit from it.
The filtered article collection stayed memoized after the component split because the list could contain enough records for repeated filtering and sorting to become noticeable during a busy session. I still checked the dependency list carefully. The memo was tied to the actual filter inputs and the source collection, not to unrelated loading state.
I kept one useCallback for a row action passed into a memoized child. That callback controlled a status update and was used by multiple rows. A stable function reference helped prevent those rows from treating every parent render as a reason to reconsider their props. In that case, the hook had a clear relationship with the component design.
Most other handlers became ordinary functions again. They were local, small, and not used by an effect or a memoized child. Wrapping them created dependency maintenance without preventing meaningful work. That distinction is easy to lose when an editor makes useCallback feel like a harmless upgrade.
The checks I made after the hook cleanup
Once the obvious render path was smaller, I checked the less glamorous causes of sluggishness. The list keys were based on stable article identifiers rather than array positions. I inspected the context provider to make sure a changing value was not forcing unrelated consumers to update. I looked at image dimensions and loading behavior for article thumbnails. I also considered whether the list would eventually need virtualization, although the current dataset did not justify adding it yet.
That last decision mattered. It would have been easy to install another library and call the page optimized. Virtualization can be useful, but it also changes scrolling behavior, measurement, keyboard navigation, and empty-state handling. The current issue was a state boundary, not a list large enough to demand a windowing strategy.
I recorded the interaction again in the Profiler after each meaningful change. The profile was not a benchmark report, and I did not pretend that one development machine represented every user. It did give me a concrete way to compare the filter interaction before and after the component split. The typing felt more responsive, the list had fewer unnecessary updates, and the code had fewer dependency arrays to audit.
The most important result was not a particular hook. It was knowing why each remaining hook existed.
React performance work often starts with a tempting code smell: a derived value, a callback prop, or a component that looks busy. I now treat those as prompts to measure, not instructions to memoize. I profile the interaction, trace where state changes, and check whether the expensive work is actually expensive. Sometimes useMemo is the right tool. Sometimes useCallback protects a useful child boundary. Quite often, moving state down one level or splitting a component removes more work with less code. The best optimization in this case was the one that made the component easier to reason about after the profiler window was closed.

Rafiqul Islam Rabbi
Full-Stack & E-Commerce Architect building high-converting Shopify stores, WordPress platforms, and Next.js web applications.