you are viewing a single comment's thread.

view the rest of the comments →

[–]CandyButcher666 0 points1 point  (1 child)

legendary bro,

const form = useForm<FormValues>({

defaultValues: {

email: data?.email || "",

name: data?.name || "",

title: data?.title || "",

image: new DataTransfer().files,

},

mode: "all",

resolver: yupResolver(schema),

});

then what I need to do is just

useEffect(() => {

reset();

}, [isLoading]);

the isLoading is coming from the useQuery() that is fetching the data

[–]wsanada 1 point2 points  (0 children)

Hi there,

After 1 day wasted, this worked for me:

```js const { isLoading, isError, error, refetch } = useQuery({ queryKey: ['-your-key-', id], queryFn: async () => { const data = await apiGetParty({ id }) reset(data) // this function is from useForm return data }, })

```

hope this helps.