Optimizing Performance with React.memo

Wrap components in React.memo to avoid unnecessary re-renders.


function MyComponent(props) {
    // logic goes here
}

export default React.memo(MyComponent);

This will Prevent unnecessary re-renders using React.memo.

For More details check this blog.

You Might Also Like

Labels: Names used to label loops and control flow

``` outerLoop: for (let i = 0; i < 3; i++) { for (let j = 0; j < 3; j++) { if (j === 1) {...

Conditional Rendering with Short Circuit

if you don’t need the else block while rendering components in React Js, you can do like this ```...