Skip to content

Commit

Permalink
Merge branch 'main' of github.com:/reasonml/reason-react into 19
Browse files Browse the repository at this point in the history
* 'main' of github.com:/reasonml/reason-react:
  feat(react): add startTransition (#838)
  feat(react): add isValidElement (#837)
  • Loading branch information
davesnx committed Jul 17, 2024
2 parents 97dd3d3 + ecccd3c commit e56f547
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/React.re
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ external component: componentLike('props, element) => component('props) =
external createElement: (component('props), 'props) => element =
"createElement";

[@mel.module "react"]
external isValidElement: element => bool = "isValidElement";

[@mel.module "react"]
external cloneElement: (element, 'props) => element = "cloneElement";

Expand Down Expand Up @@ -870,10 +873,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
6 changes: 6 additions & 0 deletions src/React.rei
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ external component: componentLike('props, element) => component('props) =
external createElement: (component('props), 'props) => element =
"createElement";

[@mel.module "react"]
external isValidElement: element => bool = "isValidElement";

[@mel.module "react"]
external cloneElement: (element, 'props) => element = "cloneElement";

Expand Down Expand Up @@ -562,6 +565,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 e56f547

Please sign in to comment.