R.M.
0
Q:

import React, { memo } from 'react';

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

New to Communities?

Join the community