Coding task · Vibe coding with Claude Code course · Module 3: Twitter clone
Practice: Feed with dynamic posts
To add a new post at the top of the list, use setPosts([newPost, ...posts]). The test adds two posts and checks that the second one is shown above the first.
Task
Write a Feed component (export default) that connects the form to the list of posts. Add 'use client' at the top of the file. Keep the posts in an array state with useState and the new post's text in a separate state bound to a textarea (value and onChange). When the form is submitted, call e.preventDefault(), add the new post to the top of the list and clear the field. Render the posts with map() and a key prop.