Created
August 18, 2019 17:35
-
-
Save hnrchrdl/a41a11993cc8f63810dd25528a31fee6 to your computer and use it in GitHub Desktop.
Example 6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Child = React.memo( | |
({ isAboveFive, children }) => { | |
console.log("child renders"); | |
return ( | |
<> | |
<h2>Child: {!isAboveFive ? "<= 5" : "> 5"}</h2> | |
{children} | |
</> | |
); | |
}, | |
(prevProps, props) => { | |
return prevProps.isAboveFive === props.isAboveFive; | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment