0

i'm trying to use react-hook-form with react-swipeable-views , but the state of the form resisted every time i switch between swipeable views, if anyone could help me i will be very thankful.

lien of stackblitz: https://stackblitz.com/edit/react-ts-mxyk44?file=Quiz.tsx

khaliloos benk
  • 67
  • 3
  • 11

1 Answers1

0

The stackblitz does not work, however I noticed that you do not use the render prop in your controllers. These are needed to get the value from the stored form.

RHF Controller doc

<Controller
  control={control}
  name="ReactDatepicker"
  render={({ field: { onChange, onBlur, value, ref } }) => (
    <ReactDatePicker onChange={onChange} onBlur={onBlur} selected={value} />
  )}
/>;
Disco
  • 1,304
  • 1
  • 6
  • 12