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

[React 19] Inconsistent documentation of useOptimistic second parameter #30638

Closed
denis-sokolov opened this issue Aug 8, 2024 · 2 comments
Closed
Labels

Comments

@denis-sokolov
Copy link
Contributor

denis-sokolov commented Aug 8, 2024

Summary

Main docs show that useOptimistic has a required second parameter updateFn.

The RC blog post does not, though.

The current version, 19.0.0-rc-e948a5ac-20240807, seems to work without the second parameter (example).

I opened the ticket here and not in the documentation repo, because this is about the upcoming version, and it seems there might not be clarity on what should be the expected behavior. Forgive me if it still was supposed to go on the other repo.

@champagnekamal
Copy link

updateFn is not required, but if you use it it will work more like usereducer hook. then you have to make the function for updateFn and then dispatch it to show optimistic value.

@denis-sokolov
Copy link
Contributor Author

Thank you! Then this does belong in the docs repo, made an issue there.

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

No branches or pull requests

2 participants