Use when a React or Next.js page opens slowly, re-renders too much, ships too much JavaScript, or lags on a click or while scrolling. Measures one route, fixes the main cause and reports the before and after medians. Not for clicking through a flow to check that it works (test-in-browser).
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Is that skill safe to install?
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
Are you the author of Optimize React?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/heyvhuang-optimize-react)
---
name: optimize-react
description: "Use when a React or Next.js page opens slowly, re-renders too much, ships too much JavaScript, or lags on a click or while scrolling. Measures one route, fixes the main cause and reports the before and after medians. Not for clicking through a flow to check that it works (test-in-browser)."
license: MIT (see LICENSE)
---
# Speed up React
## 1. Measure one milestone
Pick one route or action and a user-visible milestone, such as the product list appearing. Use a production build or a fixed preview. Record the build, device profile, fixture, cache state, and measurement method. Run at least three samples per version and record the median.
## 2. Follow the delay to its cause
Follow the measured delay to its cause:
| Evidence | First change to try |
| --- | --- |
| Requests run in series | Start independent reads together and await them at their point of use. Keep auth checks and real data dependencies in order. With streaming, put slow secondary content behind its own Suspense boundary. |
| Too much script on the first screen | Check which imports actually ship. Split large secondary features at their point of use and defer optional third-party scripts. Compare transferred JS and check the delayed feature still opens. |
| Server work repeats | Check for duplicate reads and large serialized props. Deduplicate within the request where possible. Check user and tenant boundaries before sharing a cache across requests. |
| Typing or clicking feels slow | Use the React Profiler or a browser trace to find expensive commits or long tasks. Remove unnecessary derived-state effects or narrow subscriptions before adding memoization. |
## 3. Fix the main cause and measure again
Change the main cause within the requested scope. Run the same measurement again, with the same fixture and cache policy. Check that the original content, permissions, and interactions still work. Report the before/after median, sample count, what changed, and any remaining bottleneck.
See [example.md](example.md) for a timed request waterfall.
Based on vercel-labs/agent-skills (MIT), rewritten by Copybook.