React.memo was introduced in
React 16.6 to create performance
efficient function components, these components are similar to PureComponents except that they are
function based. These components will re-render only when the props of the
component changes and not when the parent component re-renders, thereby
reducing the number of render cycles and improves the component performance.
In the below example we will create a React.memo component MyMemoComponent which will take a prop msg from the parent and display it. Remember that the memo component will only re-render when the props passed to it changes.
In the below example we will create a React.memo component MyMemoComponent which will take a prop msg from the parent and display it. Remember that the memo component will only re-render when the props passed to it changes.