diff --git a/weather/components/LocationForm.tsx b/weather/components/LocationForm.tsx new file mode 100644 index 0000000..5791c34 --- /dev/null +++ b/weather/components/LocationForm.tsx @@ -0,0 +1,52 @@ +import { useForm, Controller } from "react-hook-form"; +import { yupResolver } from "@hookform/resolvers/yup"; +import * as yup from "yup"; + +import { Button, FormWrapper, Input } from "../devlink"; + +const schema = yup + .object({ + location: yup.string().required("Please enter a location."), + }) + .required(); + +export const LocationForm = () => { + const { + handleSubmit, + control, + formState: { errors }, + } = useForm({ + defaultValues: { + location: "", + }, + resolver: yupResolver(schema), + }); + + return ( +
console.log(JSON.stringify(data)))}> + + ( + + )} + /> +