import { useState } from "react"; import { Link, useNavigate } from "react-router-dom"; import { createPost } from "../services/postService"; export default function PostCreate() { const [title, setTitle] = useState(""); const [body, setBody] = useState(""); const navigate = useNavigate() const submit = (e: React.FormEvent) => { e.preventDefault(); createPost({title: title, body: body}).then(() => navigate("/")); } return (

Create List

Back
setTitle(e.target.value)} className="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline" placeholder="Enter your title" />