import React from 'react'; import { useForm, Controller } from 'react-hook-form'; import { z } from 'zod'; import { zodResolver } from '@hookform/resolvers/zod'; const profileFormSchema = z.object({ username: z .string() .min(2, { message: "Username must be at least 2 characters.", }) .max(30, { message: "Username must not be longer than 30 characters.", }), email: z .string({ required_error: "Please select an email to display.", }) .email(), bio: z.string().max(160).min(4), }); type ProfileFormValues = z.infer; const defaultValues: Partial = { bio: "I own a computer.", }; export function ProfileForm() { const { control, handleSubmit } = useForm({ resolver: zodResolver(profileFormSchema), defaultValues, }); const onSubmit = (data: ProfileFormValues) => { console.log(JSON.stringify(data, null, 2)); }; return (
(
onChange(e.target.value)} value={value} placeholder="Enter username" /> {error &&

{error.message}

}

This is your public display name. It can be your real name or a pseudonym. You can only change this once every 30 days.

)} /> (
onChange(e.target.value)} value={value} placeholder="Enter email" type="email" /> {error &&

{error.message}

}

You can manage verified email addresses in your email settings.

)} /> (