Skip to content

Is it possible to access a field's default/initial value? #1616

Closed Answered by alexkatz
alexkatz asked this question in General
Discussion options

You must be logged in to vote

Turns out I was indeed missing something very obvious:

const field = useFieldContext<string>();

console.log({
  defaultValue: field.form.options.defaultValues?.[field.name],
  currentValue: field.state.value,
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by alexkatz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant