Skip to content

Wrappers for useTransition, useDeferredValue, etc. #128

@rome-user

Description

@rome-user

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions