From ecccd3c493276169438499d28c6c52109a29d24a Mon Sep 17 00:00:00 2001 From: RiN Date: Wed, 17 Jul 2024 14:14:26 +0700 Subject: [PATCH] feat(react): add startTransition (#838) Co-authored-by: David Sancho --- src/React.re | 5 +++++ src/React.rei | 3 +++ 2 files changed, 8 insertions(+) diff --git a/src/React.re b/src/React.re index cb2ef44f..e8c9c7fc 100644 --- a/src/React.re +++ b/src/React.re @@ -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"; diff --git a/src/React.rei b/src/React.rei index d939f38d..c7664b2b 100644 --- a/src/React.rei +++ b/src/React.rei @@ -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";