Optimize React Application Performance
Optimize your React application to achieve excellent Core Web Vitals metrics through advanced memoization and code splitting techniques.
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
Tu es un expert en performance frontend spécialisé dans React et l'optimisation des Core Web Vitals. Mon application React souffre de problèmes de performance que je dois résoudre. **Métriques actuelles :** - LCP (Largest Contentful Paint) : [EX: 4.2s, objectif < 2.5s] - FID/INP (Interaction to Next Paint) : [EX: 320ms, objectif < 200ms] - CLS (Cumulative Layout Shift) : [EX: 0.25, objectif < 0.1] - Taille du bundle JS : [EX: 2.3MB non compressé] **Stack technique :** - React [VERSION] avec [EX: Next.js 14, Vite, Create React App] - Gestion d'état : [EX: Redux Toolkit, Zustand, Context API] - Composant ou page problématique : [DESCRIPTION] **Code du composant problématique :** ```jsx [COLLER_LE_COMPOSANT_REACT] ``` Analyse et optimise en couvrant : 1. **Re-renders inutiles** : identifie les causes et applique React.memo, useMemo, useCallback avec justification pour chaque usage. 2. **Code splitting** : identifie les opportunités de lazy loading avec React.lazy et Suspense. 3. **Optimisation des images** : formats modernes (WebP, AVIF), lazy loading natif, dimensions explicites. 4. **Virtualisation** : si des listes longues sont présentes, implémente react-virtual ou react-window. 5. **Bundle analysis** : identifie les dépendances lourdes et propose des alternatives légères. 6. **Métriques après optimisation** : estime l'amélioration attendue pour chaque métrique Core Web Vitals.
Why this prompt works
<p>This prompt integrates Core Web Vitals metrics as a starting point because they provide measurable objectives and correspond to Google's ranking criteria. This data-driven approach ensures optimizations are prioritized based on their actual impact on user experience.</p><p>Requesting justification for each use of React.memo, useMemo, and useCallback is crucial: these optimizations are often misapplied and can even degrade performance if used incorrectly. Contextual explanation prevents the frequent misuse by intermediate React developers.</p><p>Estimating expected gains for each optimization transforms the analysis into a prioritized action plan, allowing efforts to focus on high-impact changes before tackling micro-optimizations.</p>
Use Cases
Expected Output
A React performance issue analysis with optimized code, optimization explanations, and estimated Core Web Vitals gains.
Learn more
Check the full skill on Prompt Guide to master this technique from A to Z.
View on Prompt Guide📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Similar Prompts
Create Your First API with Express.js
Learn to create your first Express.js REST API from A to Z with pedagogical explanations adapted to beginners.
Generate Precise Regular Expressions with AI
This prompt generates precise and documented regular expressions, tailored to your programming language, with detailed explanations and built-in tests.
Implement Robust Error Handling in Node.js
Create a professional Node.js error handling architecture with custom error classes, centralized middleware, and monitoring.
Design an Application Caching Strategy
Design a complete Redis caching strategy with appropriate patterns, TTL policy, invalidation, and stampede protection.