0 votes
in ReactJS by
What is React memo function in ReactJS, Explain with Example?

1 Answer

0 votes
by

Class components can be restricted from re-rendering when their input props are the same using PureComponent or shouldComponentUpdate. Now you can do the same with function components by wrapping them in React.memo.

const MyComponent = React.memo(function MyComponent(props) {
  /* only rerenders if props change */
});
...