support Click to see our new support page.
support For sales enquiry!

React Performance Optimization Techniques

React Performance Optimization Techniques Banner Image

Sarath KrishnanMarch 9, 2026

When building modern applications with React, performance becomes critical as your app grows. Slow rendering, unnecessary re-renders, and large bundle sizes can negatively impact user experience.

In this blog, we’ll explore practical React performance optimization techniques, including:

  • Memoization
  • Lazy Loading
  • Code Splitting
  • React Profiler
  • Avoiding Unnecessary Re-renders

 


1. Memoization in React

Memoization prevents unnecessary recalculations and re-renders by caching previous results.

React provides:

  • React.memo
  • useMemo
  • useCallback

React.memo

Wrap functional components to prevent re-rendering if props haven't changed.

const Child = React.memo(({ name }) => {

  console.log("Child rendered");

  return <p>{name}</p>;

});

Use when:

  • Component renders often
  • Props don’t change frequently
  • Component is heavy to render

useMemo

Used to memorise expensive calculations.

const expensiveValue = useMemo(() => {

 return heavyCalculation(data);

}, [data]);

Use when:

  • You have computationally expensive logic
  • You want to avoid recalculating on every render

useCallback

Memoizes functions to prevent unnecessary re-creation.

const handleClick = useCallback(() => {

 console.log("Clicked");

}, []);

Useful when passing functions to memoized child components.

 


2. Lazy Loading in React

Lazy loading loads components only when needed, reducing initial bundle size.

React provides React.lazy() and Suspense.

const Dashboard = React.lazy(() => import("./Dashboard"));

 

function App() {

 return (

   <Suspense fallback={<div>Loading...</div>}>

     <Dashboard />

   </Suspense>

 );

}

Benefits:

  • Faster initial load
  • Better user experience
  • Smaller bundle size

Perfect for:

  • Routes
  • Large components
  • Admin panels
  • Charts

 


3. Code Splitting

Code splitting divides your bundle into smaller chunks loaded on demand.

If you’re using:

  • Vite
  • Webpack
  • Next.js

Code splitting is often built-in.

Route-Based Code Splitting Example

const Home = React.lazy(() => import("./Home"));

const About = React.lazy(() => import("./About"));

Each route becomes its own JavaScript chunk.

Why it matters:

  • Reduces initial JS payload
  • Improves performance on slow networks
  • Better Lighthouse score

 


4. Using React Profiler

The React Profiler helps identify performance bottlenecks.

You can use:

  • React DevTools Profiler tab
  • <Profiler> API

Example:

<Profiler id="App" onRender={callback}>

 <App />

</Profiler>

The Profiler shows:

  • Which components re-rendered
  • How long rendering took
  • What triggered the update

This helps you:

  • Detect unnecessary re-renders
  • Identify heavy components
  • Optimize intelligently

 


5. Avoiding Unnecessary Re-renders

Unnecessary re-renders are the #1 performance issue in React apps.

Common Causes

 ❌ Parent re-renders causing child re-renders
❌ Inline functions inside JSX
❌ Inline object/array creation
❌ Mutating state directly
❌ Wrong key usage in lists

 


Fixing Inline Function Issue

Instead of:

<button onClick={() => handleClick(id)}>Click</button>

Use:

const handleClick = useCallback((id) => {

 console.log(id);

}, []);

 


Avoid Recreating Objects

Bad:

<MyComponent style={{ color: "red" }} />

Better:

const style = useMemo(() => ({ color: "red" }), []);

<MyComponent style={style} />

 


Proper Key Usage in Lists

Wrong:

{items.map((item, index) => (

 <li key={index}>{item.name}</li>

))}

Better:

{items.map((item) => (

 <li key={item.id}>{item.name}</li>

))}

Stable keys prevent unnecessary DOM diffing.

 


Real-World Optimization Strategy

Instead of optimizing everything blindly:

  1. Measure first (Profiler)
  2. Identify bottlenecks
  3. Apply memoization carefully
  4. Use lazy loading for large sections
  5. Split code strategically

Remember:

Premature optimization can make your code harder to maintain.

 


Final Thoughts

React is fast by default, but large applications need careful optimization.

By using:

  • Memoization
  • Lazy Loading
  • Code Splitting
  • React Profiler
  • Preventing unnecessary re-renders

You can significantly improve performance and user experience.

 

0

Leave a Comment

Subscribe to our Newsletter

Sign up to receive more information about our latest offers & new product announcement and more.