Answer the question
In order to leave comments, you need to log in
How to set default value to text field in React final form?
Good afternoon everyone! I used the react-final-form library on a React project, everything was fine until I needed to add a default value to the field. I can't add it at all. If anyone knows please help
Answer the question
In order to leave comments, you need to log in
initialValues
(
<Form
onSubmit={onSubmit}
subscription={{ dirty: true }}
initialValues={{ foo: 'bar' }}
>
{({ handleSubmit }) => (
<form onSubmit={handleSubmit}>
<Field name="foo" component="input" />
<button type="submit">Submit</button>
</form>
)}
</Form>
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question