Explain new features of React Memo in React v16.6 ?
Last Updated :
23 Jul, 2025
React memo is a Higher Order Component (HOC) introduced in React v16.6. As the name suggests, Memo API uses the memoization technique to optimize performance and make the application faster. The Memo API avoids unnecessary re-renders in functional components thereby optimizing the performance of the application.
We will see two different examples mentioned below:
Prerequisites:
Syntax:
const MeomizedComponent = React.memo(function MyAnotherComponent(props) {});
Steps to Create the React Application:
Step 1: Create a React App using the following command
npx create-react-app react-memo-tutorial
Step 2: After creating the project (i.e. react-memo-tutorial), move to it by using the following command.
cd react-memo-tutorial
Step 3: Create a file named Header.js in the src directory.
Project Structure:
Project StructureApproach 1: Without Using Memo
In this approach we will use a simple form to illustrate component re-rendering works without using React.memo In the Header.js we are simply rendering the Header component with props that displays the props passed from the Parent component.
Example: This example implements the above-mentioned approach
JavaScript
//Header.js
import React from "react";
const Header = (props) => {
console.log("Rendering header");
return <div>{props.title}</div>;
};
export default Header;
JavaScript
//App.js
import React, { useState } from "react";
import "./App.css";
import Header from "./Header";
const App = () => {
console.log("Rendering Form");
const [name, setName] = useState("");
return (
<div className="App">
<Header title="Input Field" />
<input
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
/>
</div>
);
};
export default App;
Output: Now open http://localhost:3000
Without MemoApproach 2: Using Memo
Here, the <Header/> component is rendered only once on startup. It is not re-rendered whenever the state changes in the <App/> component. Since we are wrapping up the Header component inside the memo, it is not re-rendering the component when the prop doesn’t change.
Example: This example implements the above-mentioned approach
JavaScript
import React from "react";
const Header = (props) => {
console.log("Rendering header");
return <div>{props.title}</div>;
};
// wrapping the component inside memo
export default React.memo(Header);
Output: Now open http://localhost:3000
With Memo
Similar Reads
New Features of strict Mode in React 18 React 18 introduces significant enhancements, especially in strict mode, aimed at improving development experiences. It offers comprehensive warnings to catch common mistakes early, along with improved component stack traces for easier debugging. These enhancements emphasize early error detection an
6 min read
Implementation of React.memo() and useMemo() in React React.memo allows functional component to have same optimization as Pure Component provides for class-based components. useMemo is for memoizing function's calls inside functional component. What is React.memo() ?React.memo() is a higher-order component (HOC) provided by React that memoizes function
3 min read
React 19 : New Features and Updates React 19 is officially released on April 25, 2024, marking a significant milestone. This release brings various new features and improvements to enhance developer experience and application performance. Many experimental features in React 18 are now considered stable in React 19, offering a more rob
15+ min read
React 19 : New Features and Updates React 19 is officially released on April 25, 2024, marking a significant milestone. This release brings various new features and improvements to enhance developer experience and application performance. Many experimental features in React 18 are now considered stable in React 19, offering a more rob
15+ min read
React 19 : New Features and Updates React 19 is officially released on April 25, 2024, marking a significant milestone. This release brings various new features and improvements to enhance developer experience and application performance. Many experimental features in React 18 are now considered stable in React 19, offering a more rob
15+ min read
Difference between React.memo() and useMemo() in React. In React applications, optimizing performance is crucial for delivering a smooth user experience. Two key tools for achieving this are React.memo() and useMemo(). While both help improve performance, they serve different purposes and are used in distinct scenarios. Table of Content What is React.mem
3 min read