`React.memo` is a higher-order component (HOC) that optimizes functional component performance by preventing re-renders when the component's props have not changed. The key mechanism it employs is a *shallow comparisonof the component's props. This shallow comparison is the crucial difference from a simple equality check. A simple equality check (using `===` in JavaScript) only compares if two variables point to the *sameobject in memory. If a prop is an object or an array, even if its contents are identical to the previous render, a simple equality check will return `false` bec....
Log in to view the answer