Skip to content

Conversation

@eotkd4791
Copy link

Reason for change

Yup typically uses the schema.validate(values, { context }) pattern, which naturally leads users to try yupResolver(schema, { context }).
However, yupResolver in @hookform/resolvers does not recommend using schemaOptions.context (there is a dev warning in the code), and this is not clearly documented in the README. This can increase debugging cost for users.

What’s changed

  • Added a short explanation in the Yup section of the README on how to pass context.
  • Clarified that context should be provided via useForm({ context }), and that this value is injected into Yup’s validation context at resolver execution time, with an example.
  • Briefly mentioned that passing React state/atoms via schemaOptions.context may appear stale or undefined.

Scope of impact

  • Documentation-only change (no behavior changes).

References

@eotkd4791 eotkd4791 force-pushed the docs/clarify-yup-resolver-context branch from c5f8d15 to 25adc7c Compare January 25, 2026 15:05
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