From c6b6915c46cc9f0cbae0b591d860d10bc885aea3 Mon Sep 17 00:00:00 2001 From: acdlite Date: Tue, 2 May 2023 15:35:13 -0700 Subject: [PATCH] Implement experimental_useFormStatus (#26722) Summary: This hook reads the status of its ancestor form component, if it exists. ```js const {pending, data, action, method} = useFormStatus(); ``` It can be used to implement a loading indicator, for example. You can think of it as a shortcut for implementing a loading state with the useTransition hook. For now, it's only available in the experimental channel. We'll share docs once its closer to being stable. There are additional APIs that will ship alongside it. Internally it's implemented using startTransition + a context object. That's a good way to think about its behavior, but the actual implementation details may change in the future. Because form elements cannot be nested, the implementation in the reconciler does not bother to keep track of multiple nested "transition providers". So although it's implemented using generic Fiber config methods, it does currently make some assumptions based on React DOM's requirements. DiffTrain build for commit https://github.com/facebook/react/commit/540bab085d571789f4562565eebfd0db9f36345c. Changelog: [Internal] << DO NOT EDIT BELOW THIS LINE >> Reviewed By: poteto Differential Revision: D45332971 Pulled By: tyao1 fbshipit-source-id: 12e2b5a6c71fc78efb8aedfd1907f65a816cc289 --- packages/react-native/Libraries/Renderer/REVISION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/Libraries/Renderer/REVISION b/packages/react-native/Libraries/Renderer/REVISION index c4e513a70b8..53c23329459 100644 --- a/packages/react-native/Libraries/Renderer/REVISION +++ b/packages/react-native/Libraries/Renderer/REVISION @@ -1 +1 @@ -6eadbe0c4aebf68410bb48147054ee22eec4c20c +540bab085d571789f4562565eebfd0db9f36345c