const App = () => { const [title, setTitle] = useState("default input"); const handleSubmit = (event) => { event.preventDefault(); const body = { title: title, }; console.log(title); }; return ( <div className="container"> <form onSubmit={handleSubmit}> <label htmlFor="title">Title</label> <input type="text" required id="title" value={title} onChange={(event) => { const value = event.target.value; setTitle(value); }} /> <button>Submit</button> </form> </div> ); };