'use client' import { useState } from 'react'; import { useRouter } from 'next/navigation'; export default function CreateEventPage() { const [name, setName] = useState(''); const router = useRouter(); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); const res = await fetch('/api/events', { method: 'POST', body: JSON.stringify({ name }), }); const data = await res.json(); router.push(`/events/${data.id}`); } return (
); }