Skip to content

docs: recommend useFormState for nested components with React Compiler - #1233

Open
TiagoGranelli wants to merge 1 commit into
react-hook-form:masterfrom
TiagoGranelli:docs/react-compiler-use-form-state
Open

TiagoGranelli wants to merge 1 commit into
react-hook-form:masterfrom
TiagoGranelli:docs/react-compiler-use-form-state

Conversation

@TiagoGranelli

Copy link
Copy Markdown

The React Compiler section of the V8 migration guide said no configuration is needed. With a compiled parent, <FormProvider {...methods}> is memoized because useForm returns a stable object, so useFormContext().formState stays stale in nested components. Calls like methods.getFieldState() on the returned object stay stale for the same reason.

This updates the section to recommend useFormState({ control }) in nested components and destructured methods, as discussed in react-hook-form/react-hook-form#13863.

I checked the example and the destructured getFieldState against 8.0.0-beta.4 compiled with babel-plugin-react-compiler 1.0.0 and with oxc-transform-react 0.154.0.

useForm returns a stable object, so a compiled parent memoizes
<FormProvider {...methods}> and useFormContext().formState stays stale.
The migration guide now recommends useFormState({ control }) in nested
components and destructured methods such as getFieldState.
@vercel

vercel Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

@TiagoGranelli is attempting to deploy a commit to the BEEKAI OSS Team on Vercel.

A member of the Team first needs to authorize it.

@netlify

netlify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for sage-cassata-31d224 ready!

Name Link
🔨 Latest commit 1a024cf
🔍 Latest deploy log https://app.netlify.com/projects/sage-cassata-31d224/deploys/6acf6a9e7f2d8b4e9d293974
😎 Deploy Preview https://deploy-preview-1233--sage-cassata-31d224.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant