Coding task · Next.js course · Module 2: Routing and Layouts

Practice: Client Component with Counter

Create an interactive Client Component

Task

Create a Client Component Counter (default export): the file starts with 'use client', you create the count state with useState(0), display it in a p paragraph, and a “+1” button increases the counter by 1 on every click.