memo

Advertisement

  • `memo` is used for function component.
  • Same as `PureComponent` class the `memo` componnent do the shallow comparison and decide to re-render the component.
  • We can use the `memo` component to improve the performance.
import React, {memo} from 'react';

function Welcome({name}) {
	return <p>Hello World</p>;
}

export default memo(Welcome);

Leave a Reply