You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
The current status of setting
defaultValues
from async data source is using
reset
:
useEffect
(()=>{reset({firstName: 'test',});
honestly, this is probably not a pretty and clean approach... a few weeks before we had a feature request regarding async
defaultValues
:
#2335
Proposal Solutions
defaultValues
accept
Promise
, and promise will get resolve
after
useEffect
, although I do have concern over the confusion which prop support both
object
and
Promise
.
const{formState: { isLoading }}=useForm({defaultValues: async()=>({firstName: 'test'})// defaultValues: new Promise()},[])
happy to discuss more options on the table too.
smashercosmo, paambaati, benswinburne, hexetia, neighborhood999 and 35 more
leonardofrp5, luanfonsecap and 4m1z
paambaati, zulaica, guidalleprane and yuchenchuang
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Issue actions