brilliant-orangeB
Refine3y ago
6 replies
brilliant-orange

uesForm Reset why not working?

const {register, handleSubmit, control, reset} = useForm<
    BaseRecord,
    HttpError,
    IPointsFilterVariables
  >({
    defaultValues: {
      q: getDefaultFilter("q", filters, "eq"),
      points: getDefaultFilter("points", filters, "eq"),
      order_date: getDefaultFilter("order_date", filters, "eq"),
    },
  });


 <LocalizationProvider dateAdapter={AdapterDayjs}>
                  <Grid container spacing={2}>
                    <Grid item xs={2} sm={2}>
                      <DatePicker
                        {...register("order_date")}
                        label="주문 시작일"
                        value={startValue}
                        name="start_date"
                        onChange={(startValue) => setStartValue(startValue)}
                        slotProps={{textField: {size: 'small'}}}
                      />
                    </Grid>
                    <Grid item xs={2} sm={2}>
                      <DatePicker
                        {...register("order_date")}
                        label="주문 종료일"
                        value={endValue}
                        name="end_date"
                        onChange={(endValue) => setEndValue(endValue)}
                        slotProps={{textField: {size: 'small'}}}
                      />
                    </Grid>
                  </Grid>
                </LocalizationProvider>



I applied reset to useform, but the DatePicker value is not initialized.
Was this page helpful?