Skip to content

Commit

Permalink
feat(react): add startTransition (#838)
Browse files Browse the repository at this point in the history
Co-authored-by: David Sancho <dsnxmoreno@gmail.com>
  • Loading branch information
r17x and davesnx committed Jul 17, 2024
1 parent 88a4fde commit ecccd3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/React.re
Original file line number Diff line number Diff line change
Expand Up @@ -872,10 +872,15 @@ module Uncurried = {
"useCallback";
};

type callback('input, 'output) = 'input => 'output;

[@mel.module "react"]
external useTransition: unit => (bool, callback(callback(unit, unit), unit)) =
"useTransition";

[@mel.module "react"]
external startTransition: ([@mel.uncurry] (unit => unit)) => unit = "startTransition";

[@mel.module "react"]
external useDebugValue: ('value, ~format: 'value => string=?, unit) => unit =
"useDebugValue";
Expand Down
3 changes: 3 additions & 0 deletions src/React.rei
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,9 @@ module Uncurried: {
"useCallback";
};

[@mel.module "react"]
external startTransition: ([@mel.uncurry] (unit => unit)) => unit = "startTransition";

[@mel.module "react"]
external useTransition: unit => (bool, callback(callback(unit, unit), unit)) =
"useTransition";
Expand Down

0 comments on commit ecccd3c

Please sign in to comment.