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

Implement missing React 18 hooks, useCallback accepts non-unit afunctions #1104

Merged
merged 5 commits into from
Dec 27, 2024

Conversation

rpiaggio
Copy link
Collaborator

Implements:

  • useDeferredValue
  • useSyncExternalStore
  • useInsertionEffect

useCallback now accepts functions that return a sync value (before it only worked on functions that returned sync or async Unit).

Copy link
Contributor

@toddburnside toddburnside left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. That was a lot typing to add those. 😆 LGTM

*
* Prefer the standard [[useEffect]] when possible to avoid blocking visual updates.
*
* If you'd only like to execute the effect when your component is mounted, then use [[useInsertionEffectOnMount]].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the documentation for these hooks was copy/pasted. 😄 For example, this IS userInsertionEffectOnMount.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I fixed the use*Effect* Scaladocs throughout now.

@rpiaggio rpiaggio merged commit 7ef9cfc into topic/react18 Dec 27, 2024
2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants