79267600

Date: 2024-12-10 09:10:50
Score: 2
Natty:
Report link

when initializing the useForm hook all I needed to do was pass in the additional option called "defaultValues". This would set my form field values from the get go.

  const form = useForm<z.infer<typeof blog>>({
    resolver: zodResolver(blog),
    defaultValues: { title: title, length: length, content: content },
  });
Reasons:
  • Blacklisted phrase (0.5): I need
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Starts with a question (0.5): when init
  • Low reputation (1):
Posted by: Zheng Jiawen