[v7] Checkbox value is not updated in onChange mode

Describe the bug
When using “onChange” mode on a checkbox, the “data” value is not aligned with the native “checked” value

Codesandbox link (Required)

import { useForm } from "react-hook-form";

export default function App() {
  const { register, handleSubmit } = useForm({
    mode: "onChange"
  });
  const onSubmit = (data, e) => console.log(data);

  return (
    <form onSubmit={handleSubmit(onSubmit)}>
      <input
        type="checkbox"
        {...register("test")}
        onChange={(e) => {
          console.log(e.target.checked);
          handleSubmit(onSubmit)(e);
        }}
      />
    </form>
  );
}

Expected behavior
The handleSubmit should return same value as native “checked” vlaue

1 possible answer(s) on “[v7] Checkbox value is not updated in onChange mode