Open utterances-bot opened 2 years ago
Interesting, sounds very useful. But my first thought was, you could use useEffect with dependency array optimization to achieve the same effect, and then put the result in a useState.
Interesting, sounds very useful. But my first thought was, you could use useEffect with dependency array optimization to achieve the same effect, and then put the result in a useState.
Sure, there are many ways you could re-create the useMemo()
logic.
awsome content as always, thank you very much
Hello Dmitri!
Your content guides me with clarity when I need it. Thanks!
I have a large object that holds memoized objects as you see here:
const tableToolbarItems = { contract: **useMemo**( () => []), user: **useMemo**( () => []), items: **useMemo**( () => []) }
I do it to organize a large collection of related objects. I feed some React components using tableToolbarItems.user tableToolbarItems.items etc
I would like to keep this structure because it self-organize my code and plan to also memoize the host object.
Something like this:
const tableToolbarItems =()=> **useMemo**({ contract: useMemo( () => []), user: useMemo( () => []), items: useMemo( () => []) },[])
Have you ever worked with nested memoization?
You can’t do the same logic with useEffect if it’s an object because of referential equality. UseEffect would also cause the component to re render
Hi, I'm trying to understand memo api but I still don't get it. I write a question in stackoverflow based on your post, can you give me a hand? Ty. https://stackoverflow.com/questions/72775948/how-react-memo-works-with-usecallback
sorry, wrong posts
Love your tutorial, it's more helpful that the React official docs. Thanks, Dmitri!
@thequinn Thank you!
nice tutorial!
nice tutorial!
@joaovtpereira Thanks!
thanks!
How to Memoize with React.useMemo()
How and when to use React.useMemo() hook to improve the performance of React components.
https://dmitripavlutin.com/react-usememo-hook/