react-hook-form / codemod

Migrate React Hook Form V6 to V7 made simple.
MIT License
26 stars 7 forks source link

No support to update controller render props #15

Open gik-hub opened 2 months ago

gik-hub commented 2 months ago

Is your feature request related to a problem? Please describe. I am migrating from react hook form v6 to v7 and need to migrate the controller render prop implementation which I had not seen present in the codemod <Controller control={control} name="test" render={( { onChange, onBlur, value, name, ref }, { invalid, isTouched, isDirty } ) => ( <Checkbox onBlur={onBlur} onChange={(e) => onChange(e.target.checked)} checked={value} inputRef={ref} /> )} />

Describe the solution you'd like I would like to have a solution which can convert the v6 syntax above to the one in v7 as share below: <Controller control={control} name="test" render={({ field: { onChange, onBlur, value, name, ref }, fieldState: { invalid, isTouched, isDirty, error }, formState, }) => ( <Checkbox onBlur={onBlur} // notify when input is touched onChange={onChange} // send value to hook form checked={value} inputRef={ref} /> )} /> Describe alternatives you've considered

Additional context