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

Wrappers for useTransition, useDeferredValue, etc. #128

Open
rome-user opened this issue Apr 11, 2023 · 1 comment
Open

Wrappers for useTransition, useDeferredValue, etc. #128

rome-user opened this issue Apr 11, 2023 · 1 comment

Comments

@rome-user
Copy link
Contributor

Adding the remaining of new React 18 hooks would be nice to have. But some hooks will allow us to provide an API more interesting than simply (def use-x react/useX). For instance, helix.hooks/use-state returns a setter function that can behave like swap!, and helix.hooks/use-ref returns a ref that implements IDeref. Very cool stuff.

In particular, the useTransition hook will benefit from having a similar API to helix.hooks/use-effect, where the body is already wrapped in a fn for us. I plan to sketch some wrappers for this over this weekend.

I am filing this issue so that we can discuss these ideas. In particular, I find useTransition and useDeferredValue to be the most interesting new hooks to target. Both of these hooks give us functionality to run effects or update component state without having to block renders.

@lilactown
Copy link
Owner

Yeah I think this sounds like a great idea

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