react-performance
Skill4 starsChanged 5 months agoMITView on GitHub
React performance: unnecessary re-renders, memoization (React.memo/useMemo/useCallback), React Compiler, Context, concurrent features, code splitting, and Core Web Vitals.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- templetongroup/radianttheir own version, first seen Sep 17, 2026
- jscott3201/yet-more-skillstheir own version, first seen Sep 7, 2026
- socialadsmentor/sam-agentic-harnesstheir own version, first seen Sep 3, 2026
- Evan-Kim2028/agent-skillstheir own version, first seen Aug 16, 2026
- SamuelNDCE/claude-super-skill-librarytheir own version, first seen Aug 1, 2026
- JunMystery/Agent-Guidance-Pythontheir own version, first seen Jul 21, 2026
Used with
Projects with it also use vite-patterns, react-testing and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
aragaobrunoSkillvite-patterns
Vite build tool patterns including config, plugins, HMR, env variables, proxy setup, SSR, library mode, dependency pre-bundling, and build optimization. Activate when working with vite.config.ts, Vite plugins, or Vite-based projects.
Also in 3 projects that use this
SentrySkillreact-testing
Write and review React/TypeScript tests for Sentry's frontend using Jest and React Testing Library. Use when adding or editing tests in static/ (*.spec.tsx), writing component/hook tests, mocking API responses with MockApiClient, testing routing or network requests, or when asked to "write a frontend test", "add a React test", "test this component", or "fix a flaky RTL test".
Also in 4 projects that use this
joneqianSkillpostgres-patterns
PostgreSQL database patterns for query optimization, schema design, indexing, and security. Based on Supabase best practices.
Also in 3 projects that use this
InfopibeSkilldeployment-patterns
Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.
Also in 3 projects that use this
LangChainSkilldocker-patterns
Best practices for Docker containerization and multi-stage builds
Also in 3 projects that use this
mryeastcodeSkillcontext-budget
Audits Claude Code context window consumption across agents, skills, MCP servers, and rules. Identifies bloat, redundant components, and produces prioritized token-savings recommendations.
Also in 3 projects that use this
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- templetongroup/radiant★ 113same name
- s-hiraoku/synapse-a2a★ 16same name
- wpank/ai★ 11same name
- jscott3201/yet-more-skills★ 4same name
- socialadsmentor/sam-agentic-harness★ 4same name
- LeahyCC/claude-skills★ 3same name
- aragaobruno/monster-antigravity★ 2same name
- JunMystery/Agent-Guidance-Python★ 2same name
- Evan-Kim2028/agent-skills★ 1same name
- Nupke/react-claude-skills★ 1same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository63 other files it gives its agents.
- .claude/skills/nestjs-best-practices/AGENTS.mdAGENTS.md
- accessibility-a11ySkill
- architecture-blueprint-generatorSkill
- backend-delivery-loopSkill
- backend-designSkill
- backend-dev-guidelinesSkill
- backend-testingSkill
- backend-to-frontend-handoff-docsSkill
- building-componentsSkill
- bullmq-specialistSkill
- canvas-designSkill
- code-patternsSkill
- components-composition-patternsSkill
- conventional-commitSkill
- core-web-vitalsSkill
- create-svgSkill
- css-architectureSkill
- cypress-authorSkill
- cypress-docsSkill
- cypress-explainSkill
- delivery-loop-retroSkill
- diagnoseSkill
- fastify-best-practicesSkill
- figma-code-connectSkill
- frontend-delivery-loopSkill
- frontend-fundamentalsSkill
- fullstack-delivery-loopSkill
- grill-meSkill
- hunt-race-conditionSkill
- impeccableSkill
- mermaid-diagramsSkill
- nestjs-best-practicesSkill
- nextjs-best-practicesSkill
- nextjs-performanceSkill
- nodejs-backend-patternsSkill
- owasp-security-reviewSkill
- performance-hunterSkill
- playwright-best-practicesSkill
- postgresql-code-reviewSkill
- postgresql-optimizationSkill
- postmanSkill
- prisma-postgresSkill
- pro-state-machineSkill
- race-conditionSkill
- react-best-practicesSkill
- react-querySkill
- redis-coreSkill
- redis-query-engineSkill
- redis-securitySkill
- refactorSkill
- review-panelSkill
- run-delivery-chainSkill
- spec-drivenSkill
- sql-optimizationSkill
- system-designSkill
- testing-strategySkill
- tune-skills-and-agentsSkill
- ui-ux-pro-maxSkill
- vercel-react-view-transitionsSkill
- viteSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Always follow this order — measure before optimizing:
- Distinctive: line 16
Rule #1: Do NOT measure the development build.
- Distinctive: line 35
Before reaching for memoization, fix your state architecture.
- Distinctive: line 72
If a value can be computed from existing state/props, compute it — don't store it.
- Distinctive: line 87
Only lift state to the lowest common ancestor that needs it — no higher.
- Very specific: line 136
Never create a "mega context" with unrelated state.
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Performance Debugging Workflow
Always follow this order — measure before optimizing:
- Reproduce — Document exact steps, browser, device, network conditions
- Measure — Profile with React DevTools Profiler + Chrome Performance tab. Never measure development builds.
- Identify — Form a specific hypothesis about the cause
- Fix — Apply the minimal fix needed
- Verify — Measure improvement under same conditions
Rule #1: Do NOT measure the development build. For production profiling, alias:
react-dom$→react-dom/profilingscheduler/tracing→scheduler/tracing-profiling
Rule #2: Simulate real user conditions (slow CPU, throttled network).
Why Components Re-render
Components re-render for exactly three reasons:
- Its state changed
- Its parent rendered (unless wrapped in
React.memo) - A consumed Context value changed
Renders are either necessary or unnecessary. Any single unnecessary render is rarely a problem — it's the accumulation over time.
State Architecture (Fix Before Memoizing)
Before reaching for memoization, fix your state architecture. These are free performance wins:
Colocate State
Move state to the closest component that needs it. State at the root re-renders the entire tree.
// BAD: searchQuery in App re-renders Header, Cart, Footer
function App() {
const [searchQuery, setSearchQuery] = useState("");
return (
<>
<Header />
<SearchBar query={searchQuery} onChange={setSearchQuery} />
<Cart />
</>
);
}
// GOOD: searchQuery lives in SearchSection
function App() {
return (
<>
<Header />
<SearchSection />
<Cart />
</>
);
}
function SearchSection() {
const [searchQuery, setSearchQuery] = useState("");
return <SearchBar query={searchQuery} onChange={setSearchQuery} />;
}Derive, Don't Store
If a value can be computed from existing state/props, compute it — don't store it.
// BAD: synchronized state
const [items, setItems] = useState<Item[]>([]);
const [filteredItems, setFilteredItems] = useState<Item[]>([]);
// Must keep in sync — bugs + extra renders
// GOOD: derived value
const [items, setItems] = useState<Item[]>([]);
const filteredItems = items.filter((i) => i.active); // or useMemo if expensiveLift State Intelligently
Only lift state to the lowest common ancestor that needs it — no higher.
Memoization Decision Guide
Three memoization tools, each with specific use cases:
| Tool | What it caches | Use when |
React.memo | Component render output | Profiler shows component re-renders due to parent, not its own props/state |
useMemo | Computation result | Expensive calculation runs on every render, OR referential stability for memoized children |
useCallback | Function identity | Function passed as prop to React.memo-wrapped child, OR used in dependency arrays |
Key rule: useMemo/useCallback are pointless without React.memo on the receiving child (or a dependency array consumer).
When NOT to Memoize
- Simple/cheap components that render fast
- Props that change on almost every render anyway
- Components without memoized children receiving the value
- Simple calculations (the comparison overhead exceeds computation cost)
React Compiler
The React Compiler is a Babel plugin that automatically applies memoization at build time. It analyzes your code and inserts useMemo/useCallback where safe.
Prerequisites: Code must follow the Rules of React — components must be pure, props/state immutable, no side effects in render.
What the Compiler Handles
- Stabilizing callback identities (replaces manual
useCallback) - Memoizing derived values (replaces manual
useMemo) - Memoizing JSX output (replaces many
React.memowrappers)
What You Still Need Manually
React.memo: Impure components, 3rd-party library components, explicit render boundariesuseMemo: Truly expensive computations the compiler can't prove safe, custom equality logicuseCallback: Complex closure semantics, library APIs requiring stable function identities
Context API Performance
Context is a broadcast mechanism — every consumer re-renders when the value changes. The fix is splitting.
The Two-Context Pattern
Separate state from dispatch/actions into two contexts so components that only dispatch never re-render when state changes (full Provider example in references/context-optimization.md).
Split by Domain
Never create a "mega context" with unrelated state. Split into ThemeContext, AuthContext, UIContext, etc.
Concurrent Features
useTransition vs useDeferredValue
useTransition | useDeferredValue | |
| Wraps | The action (setState call) | The value (result) |
| Use when | You control the state update | You don't control the update |
| Provides | isPending boolean | Compare current vs deferred value |
| Effect | Marks update as low-priority | Value lags behind during urgent updates |
Neither makes anything faster — they make the UI feel faster by prioritizing urgent updates (typing) over expensive work (filtering). Code examples for both, plus Suspense and data-fetching patterns, live in references/concurrent-features.md.
Bundle Performance
Code Splitting Checklist
- Route-based splitting —
lazy()+Suspensefor each route - Heavy component splitting — Lazy-load modals, charts, editors
- Conditional feature splitting — Admin panels, premium features
- Bundle analysis — Use
webpack-bundle-analyzerorsource-map-explorer - Tree shaking — Use named exports, check
sideEffectsin package.json
Core Web Vitals Quick Reference
| Metric | Target | React Optimization |
| LCP (Largest Contentful Paint) | < 2.5s | SSR/SSG, preload critical assets, optimize images |
| INP (Interaction to Next Paint) | < 200ms | Break long tasks, memoize, debounce/throttle, Web Workers |
| CLS (Cumulative Layout Shift) | < 0.1 | Set image dimensions, reserve space for async content, skeleton loaders |
React Fiber — How Rendering Works
React Fiber is a cooperatively-scheduled rendering engine using a linked-list tree structure.
- Two trees: Current (what DOM reflects) and Work-in-Progress (draft being prepared)
- Yielding: React yields to browser every ~5ms, allowing paint/input handling
- Lanes: Priority system using bitmasks —
SyncLane>InputContinuousLane>DefaultLane>TransitionLane>IdleLane - Commits are never interrupted — once render phase completes, DOM updates happen synchronously
Understanding this helps explain why useTransition works: it assigns updates to lower-priority lanes.
References
Each file is loaded on demand — read one only when the task needs that depth (progressive disclosure).
references/profiling-and-debugging.md— the systematic measure-before-optimize workflow, the React DevTools Profiler, the Chrome Performance tab, and production-profiling build setup · read when measuring, reproducing, or diagnosing a slowdown before touching code.references/memoization-patterns.md—React.memo,useMemo, anduseCallbackin depth with custom comparators and the dependency-array rules · read when applying memoization or deciding which of the three to reach for.references/react-compiler.md— React Compiler setup, how it auto-memoizes, migration steps, and what still needs manual memoization · read when adopting/migrating to the React Compiler or auditing what it can't cover.references/context-optimization.md— the two-context (state/dispatch) Provider pattern, the mega-context anti-pattern, and domain splitting · read when a Context value re-renders too many consumers.references/concurrent-features.md—useTransition,useDeferredValue, and Suspense with full code and data-fetching patterns · read when making expensive updates non-blocking or wiring Suspense.references/bundle-and-loading.md— code splitting,lazy()/Suspenseroute and component splitting, lazy-loading patterns, tree shaking, and bundle analysis · read when reducing bundle size or implementing lazy loading.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

