-
-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useMemo not explained in Tutorial #1025
Comments
That's valuable feedback thank you! |
I understand useMemo is used for expensive computations, but somehow failing to understand why in tutorial user or increment are defined as expensive computations? |
As Jovi mentions, memoization isn't exclusively for expensive computations, it can also used to create stable references. Without memoizing in that example, each render of It might not be the best example (contributions welcome & appreciated!) but it does serve a purpose, it's not "random". |
Thank you for explanation. It makes more sense to me now. |
Fully agree, we could do with fleshing out our hooks docs in general, it's all super light on details, examples, etc. Will go on my to-do! |
The Context part of the tutorial uses the
useMemo()
hook, but there's no explanation what this does and how it's used.Later you are asked to use it yourself when solving the exercise. I still didn't understand what it does, even after reading the solution.
The text was updated successfully, but these errors were encountered: