-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Bug: useMemo with Suspense #20877
Comments
In order of This is even more true for
Meaning that if your code doesn't work for some reason, sticking |
Indeed, Suspense is meant to only be backed by a cache. Component state or useMemo is not enough. See #17526 (comment) for more detailed requirements. |
It is reasonable and logical for me to do so |
I know, but it is also reasonable and logical for me to use UseMemo or UseCallback to cache resources. |
Maybe you should provide a hook so that I can store the resource in the component instead of having to store it in the parent component and pass it to the child component as a prop |
Can you provide a hook to implement the above
Can you provide a hook to implement the above |
React version: 17.0.1
Steps To Reproduce
Link to code example: codesandbox
The current behavior
'useMemo' is called repeatedly when when 'fetch' is called
The expected behavior
'useMemo' is called only when the dependencies changed
The text was updated successfully, but these errors were encountered: