1function MyComponent(props) {
2 /* render using props */
3}
4function areEqual(prevProps, nextProps) {
5 /*
6 return true if passing nextProps to render would return
7 the same result as passing prevProps to render,
8 otherwise return false
9 */
10}
11export default React.memo(MyComponent, areEqual);
1const MyComponent = React.memo(function MyComponent(props) {
2 /* only rerenders if props change */
3});