"use client"; import { getLocation } from "@/app/actions"; import { useState } from "react"; import { useFormStatus } from "react-dom"; export default function LocationSearch(props: any) { const [searchLocation, setSearchLocation] = useState(""); const setGeoLocation = props.setGeoLocation; const { pending } = useFormStatus(); const handleChange = (e: React.ChangeEvent) => { setSearchLocation(e.target.value); }; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); try { const coordinates = await getLocation(searchLocation); setGeoLocation(coordinates); } catch (error) { console.error("Error fetching location:", error); } }; return ( <>
); }