The ticket said the app felt slow. No screen, no device, no time of day. Everyone had a theory: the API, the images, React itself, the phone. Nobody had a measurement.
That is the real problem. "Slow" is not something you can assign to a person or fix in a pull request. Before touching a line of code I needed three answers from three places: what re-renders, what the network does, and how much JavaScript the browser has to download before it can paint anything.
Here is the pass I ran, in order, and what it found.
1. React Profiler: what re-renders, and why
I started on the screens people complained about most, recorded a normal session in the React DevTools Profiler, and read the ranked view instead of the flame chart. The ranked view sorts components by how much time they spent rendering, which is usually where the answer is.
The finding was blunt: screens were re-rendering far more often than their data changed. Moving a filter, typing in a search box, opening a drawer - all of it re-rendered subtrees that had nothing to do with the change.
The usual causes are unglamorous:
- A state update high in the tree that everything below subscribes to.
- A context provider whose
valueis a new object on every render, so every consumer re-renders even when nothing it cares about changed. - Lists rebuilt from scratch because keys are missing or are array indexes.
- Callbacks passed down as inline arrows, defeating
memo.
None of these show up in a code review. They show up in the profiler in about ten minutes, with the component names attached.
2. Network panel on a mid-range Android
The second mistake I see teams make is profiling on a MacBook. Your users are not on your laptop. I plugged in a mid-range Android phone, enabled USB debugging, and recorded the same flows in Chrome DevTools.
That is where the request waterfall showed itself: data fetching was stacked in a chain. The screen loaded, then asked for the user, then asked for the user's orders, then asked for the items in those orders. Four round trips, each one waiting for the last, each one carrying latency the user pays for.
On a fast connection that costs a few hundred milliseconds. On a mid-range phone on mobile data it costs seconds, and it happens on every navigation.
3. Lighthouse on a throttled connection
Third measurement: Lighthouse with mobile emulation and throttling on. Not to chase a score, but to answer one question - how much JavaScript has to arrive and execute before the first screen means anything?
The answer: the first bundle shipped roughly half the application before the header rendered. The marketing pages, the settings screens, the admin tools - all of it in the same chunk as the landing screen.
The fixes, in the order I did them
Order matters. Fixing the bundle before fixing the network, or the network before the re-renders, wastes a week on the smallest cost.
1. Server-side rendering for the heavy routes. The first paint stopped waiting on JavaScript for the screens that mattered most: the entry points people land on. The trade-off is real - you now need a Node process in front of the app, your data fetching has to work on the server, and you have to be careful about hydration mismatches. But for first paint on a slow connection it is the biggest single win available.
2. Dynamic imports for everything else. Route-level code splitting plus next/dynamic for panels and modals that are not needed on first paint. The rest of the bundle stopped sitting on the critical path. The cost is loading states you now have to design, and a rule about what may be imported statically.
3. SWR for data. The chained requests became parallel requests, with cached data on the client. A screen that needed four things now asks for four things at once, and on the second visit it renders from cache while it revalidates. The cost is a decision you have to make per screen: how stale is acceptable, and what does the user see while it revalidates.
Mobile load time improved noticeably. I am not going to give you a hero number for it, because we were tracking three different metrics and the honest answer is that the page stopped making people wait. The support messages about the app being slow stopped, which was the actual goal.
What I would do differently
- Keep the baseline. We measured once, fixed, and moved on. A performance budget in CI - bundle size, LCP on a throttled profile - would have stopped the regression six months later.
- Do not SSR everything. SSR is expensive to run and easy to over-apply. SSR the entry screens, keep the authenticated app client-side.
- Watch the fix that moves the problem. SSR with a slow data fetch on the server just moves the wait from the client to the server and adds TTFB. Measure after, every time.
The rule I kept
Measure first, fix the biggest cost, measure again.
"The app is slow" has a different answer in every codebase I have worked in. In this one it was three small things, not one big one - and none of them were the API, which is what everyone suspected on day one.

