react-hooks-helper icon indicating copy to clipboard operation
react-hooks-helper copied to clipboard

Checkbox input not saving checked state

Open IlirBajrami opened this issue 3 years ago • 0 comments

I'm trying to implement a form with checkboxes like this:

{Object.entries(Services).map(([value, name]) => (
        <FormItem
          id={value}
          key={value}
          label={name}
          name={name}
          value={value}
         
          onChange={setForm}
          type='checkbox'
        />
      ))}

but when i click next and then back again (of course using navigation from your useStep helper) the checkbox i previously checked is not checked anymore. How can i fix this or i have to write separate function to keep the state?

Note: The state is saved just fine on other input types using useForm, except checkbox.

EDIT: The state is not saved on any field except type text. Noticed that even if the field is of type textarea, it's not saved

IlirBajrami avatar May 17 '22 10:05 IlirBajrami