Memoize Components

Loading "Memoize Components"
πŸ¦‰ Memoizing elements is such a common idea that React has a built-in optimizer called memo which allows you to memoize an entire component based on its props:
import { memo } from 'react'

const MyComponent = memo(function MyComponent(props) {
	/* only rerenders if props change */
})
This effectively turns the props object into a dependency array a la useMemo and applys wherever the component is rendered.
πŸ§β€β™‚οΈ I've moved the Footer out of useMemo so we've got it rendering unnecessarily again.
πŸ‘¨β€πŸ’Ό You're going to use memo to get the Footer back into a position where it only renders when the name or color change. Good luck!
The tests rely on the name of your memoized component being FooterImpl, like this:
const Footer = memo(function FooterImpl(props) {
	// ...
})
If you name it differently, the tests will fail.

Please set the playground first

Loading "Memoize Components"
Loading "Memoize Components"

Access Denied

You must login or register for the workshop to view the diff.

Check out this video to see how the diff tab works.