Christian Genco

react

Change the value of a checkbox #

To control an input with type="checkbox" set the value with checked instead of value and get the value from e.target.checked instead of e.target.value:

<input
  type="checkbox"
  checked={checked}
  onChange={(e) => setChecked(e.target.checked)}
/>