Topics

On this page

Last updated on Dec 4, 2025

Performance optimization

Optimizing React apps isn’t about memoizing everything, it’s about knowing when and where to optimize. Most performance problems come from unnecessary re-renders, oversized bundles, or heavy computations inside the render cycle.

This section outlines practical strategies and ways to keep apps fast, responsive, and maintainable.

Core react optimizations

React.memo

useMemo

useCallback

Lazy loading and Dynamic Imports( Code-splitting )

const Chart = React.lazy(() => import('./Chart'))

Avoiding unnecessary re-renders

Prop drilling without memoization

If you pass down props through many layers, use memo, useMemo, or context only when needed. Prop changes ripple down; stabilize prop shapes where possible.

Stable function references

Avoid inline/anonymous functions in JSX (in hot paths)

In loops or re-render-heavy areas, extract handlers or memoize them.

// ❌Inefficient
<List onClick={() => doSomething(item)} />

// ✅ Better
const handleClick = useCallback(() => doSomething(item), [item])
<List onClick={handleClick} />

Memoize list items

Limit use of context

Profiling and debugging tools

React DevTools Profiler

Why-did-you-render (development only)

import whyDidYouRender from '@welldone-software/why-did-you-render'

if (process.env.NODE_ENV === 'development') {
  whyDidYouRender(React)
} 

Lighthouse / Web Vitals

Code-splitting: Lazy loading routes and components (React.lazy, Suspense) to keep bundle size down in case of complex components.

Dependency boundaries

Ensure packages depend only on what’s necessary to avoid circular dependencies. Tools like npm-prune can help.


Credits

Authored by Sayed Sayed Sayed Taqui Director of Engineering – React , Imran Imran Imran Sayed Senior WordPress Engineer , Ayush Ayush Ayush Nirwal Senior Software Engineer , Amoghavarsha Amoghavarsha Amoghavarsha Kudaligi Senior Software Engineer , Mayank Mayank Mayank Rana Senior Software Engineer