Part 1: Adding A Form
Writing the Form
<form className="book-form" onSubmit={handleSubmit}>
<div>
<label htmlFor="title">Title:</label>
<input
type="text"
id="title"
value={title}
onChange={(e) => setTitle(e.target.value)}
required
/>
</div>
<div>
<label htmlFor="author">Author:</label>
<input
type="text"
id="author"
value={author}
onChange={(e) => setAuthor(e.target.value)}
required
/>
</div>
<button className='button' type="submit">Add Book</button>
</form>Form submission logic
Styling the Form

Last updated