Skip to content
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

Open
MightyPork opened this issue Nov 14, 2023 · 1 comment
Open

useMemo not explained in Tutorial #1025

MightyPork opened this issue Nov 14, 2023 · 1 comment

Comments

@MightyPork
Copy link

MightyPork commented Nov 14, 2023

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.

@JoviDeCroock
Copy link
Member

That's valuable feedback thank you! useMemo returns a stable reference for a given value, so it can be used to run expensive computations, .... and only re-calculate when the dependencies contained within the second argument (the array) change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants