I have a component in my form that stores tags in a useState, but I don't know how to send that array to Formik's initialValues. I need to be able to send that data to the key called "tags" in Formik's initialValues, if someone could help me, thank you very much.
const AddProject2 = () => {
const [tags, setTags] = useState([]);
return (
<Formik
initialValues={{
name: "",
tags: [],
}}
onSubmit={(values) => {
console.log(values);
}}
>
{() => (
<Form>
<div>
<label htmlFor="name">NameProject</label>
<Field type="text" name="name" />
</div>
<ReactTagInput
placeholder="Write the tags"
tags={tags}
onChange={(newTags) => setTags(newTags)}
/>
<button type="submit">Send</button>
</Form>
)}
</Formik>
);
};
export default AddProject2;