Created
March 3, 2024 11:43
-
-
Save sifat009/5dfe8aa2014ad6f9a7a1190298ef771b to your computer and use it in GitHub Desktop.
useMemo the right way
This file contains 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
/** | |
* ✅ Topic: Unnecessary useMemo() on props 🧐 | |
* 📨 For training contact: sifathaque6@gmail.com 💬 | |
*/ | |
const ChildrenMemo = React.memo(Children) | |
const Parent = () => { | |
const value = useMemo(() => ({value})); | |
return <ChildrenMemo value={value} /> // ✅ Memoized value will prevent re-render | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment