I'm using formik with checkbox fields, on select it gives id's and the next page is render, but when I get back to the page the checked fields go back to their default values i.e empty. How can I prevent it?
<Formik
initialValues={{
pocList: "",
}}
onSubmit={onSubmit}
>
{({ handleSubmit, setFieldValue }) => {
formRef.current = { handleSubmit, setFieldValue };
return (
<Form style={{ width: "100%", marginTop: 10, marginBottom: 50 }}>
<FormItem>
{filteredPocList?.map(item => {
return (
<Field
key={item.id}
as={PocCard}
type="checkbox"
name="pocList"
value={item.id}
username={item.name}
email={item.email}
/>
);
})}
</FormItem>
</Form>
);
}}
</Formik>