Coding task · Vibe coding with Claude Code course · Module 3: Twitter clone

Practice: Post form

e.preventDefault() stops the page from reloading after the form is submitted, and you clear the field by setting the state to an empty string. The test types into the textarea and submits the form.

Task

Write a CreatePostForm component (export default), a form for the captain's logbook. Add 'use client' at the top of the file. Inside a form tag put a textarea whose content you keep in useState (value and onChange) and a submit button (a button of type submit). In onSubmit call e.preventDefault() and clear the field.