Skip to main content

React Prompt to Build a Performance Optimization Playbook

Diagnose and fix React performance issues with memoization, lazy loading, virtualization, bundle splitting and render tuning.

Fill in the placeholders

Edit the values, then copy your finished prompt.

Your Prompt
prompt.txt

                                

What this prompt does

This prompt produces a prioritized performance optimization plan for a React app, grounded in your actual problems rather than guesswork. It audits unnecessary re-renders (React.memo, useMemo, useCallback), adds code splitting with React.lazy, virtualizes large lists, optimizes images, analyzes the bundle, offloads heavy computation to a Web Worker, adds Suspense boundaries, and proposes a Service Worker caching strategy — all tied to before/after targets for LCP, FID, and CLS, with a Profiler usage guide.

The variables anchor the plan in reality. [performance_issues] describes the symptoms (slow load, janky scrolling, large bundle), [app_details] gives context, and the rest target specific fixes: [split_targets] are routes to lazy-load, [large_lists] are the components to virtualize with [virtualization_lib], and [heavy_computation] is what moves to a Web Worker. Because the prompt insists on working from real Profiler data and tying each fix to LCP and CLS targets, the effort stays honest — you address the unnecessary re-renders and oversized bundles that usually cause slowness, with list virtualization typically the single biggest win on data-heavy screens.

When to use it

  • Diagnosing a React app that feels slow without knowing the root cause
  • Prioritizing performance work so you fix the costly problems first
  • Virtualizing lists rendering thousands of rows that jank on scroll
  • Code-splitting heavy routes to shrink the initial bundle
  • Moving CPU-heavy work (parsing, aggregation) off the main thread
  • Tying optimization effort to measurable Core Web Vitals targets

Example output

You get a prioritized plan: a re-render audit naming likely offenders, code-splitting recommendations for your [split_targets], a virtualization approach for [large_lists] using [virtualization_lib], image optimization steps, a bundle analysis with tree-shaking suggestions, a Web Worker plan for [heavy_computation], Suspense boundary placement, and a Service Worker caching strategy. Each item carries before/after targets for LCP, FID, and CLS, plus a guide to using the React DevTools Profiler to confirm the wins are real rather than assumed.

Pro tips

  • Fill [performance_issues] from real measurements (5s load, 2MB bundle), not impressions — the plan is only as good as the symptoms you feed it
  • Start with [large_lists] virtualization if you have data-heavy screens; it's usually the biggest single win for the least risk
  • Don't carpet-bomb with React.memo; the audit should identify specific re-render hotspots, and over-memoizing adds its own overhead
  • Pick a [virtualization_lib] you'll maintain (TanStack Virtual is solid) rather than rolling your own windowing
  • Validate each fix against the LCP/CLS targets in the Profiler before moving on, so you don't chase premature optimizations
  • Be precise about [heavy_computation]; only genuinely blocking work belongs in a Web Worker, since the messaging overhead isn't free

Frequently Asked Questions

Should I just wrap everything in React.memo?
No. Over-memoizing adds comparison overhead and can hurt performance. The prompt audits for specific re-render hotspots so you apply memoization where it measurably helps, rather than blanketing the whole tree and creating new costs.
What is usually the biggest performance win?
On data-heavy screens, list virtualization typically delivers the largest improvement for the least risk, because rendering thousands of DOM nodes is a common cause of jank. The prompt targets your large lists specifically with a virtualization library.
Does the plan rely on real measurements?
It is designed to. You describe your actual performance issues and the prompt ties each fix to before-and-after targets for LCP, FID, and CLS, plus a Profiler guide. Feeding it real numbers rather than impressions is what keeps the effort honest.
When should I move work to a Web Worker?
Only when the computation genuinely blocks the main thread, such as parsing large CSVs or aggregating chart data. Web Workers add messaging overhead, so trivial work does not belong there. The prompt scopes this to the heavy computation you specify.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

More in React & Next.js Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support