How to migrate some of the react-hook-form controller v6 properties to v7

Viewed 42

I am migrating react-hook-form to "^7.34.2" for my react next.js app. https://react-hook-form.com/migrate-v6-to-v7/ very minimal. How to migrate the following properties?

        <Controller
          as={TextField}
          control={control}
          name="country"
          rules={{ required: true }}
          label="Country"
          error={Boolean(formState.errors.country)}
          helperText={formState.errors.country?.message}
          sx={{
            mr: 3,
            mt: { xs: 3, sm: 6 },
          }}
          className={formState.errors?.country ? classes.textfieldStyleRequired : classes.textfieldStyle}
          select
        >
          {COUNTRIES?.map((country) => {
            return (
              <MenuItem key={country} value={country} className={classes.optionText}>
                {country}
              </MenuItem>
            )
          })}
        </Controller>
0 Answers
Related