Coding task · Next.js course · Module 1: Next.js Configuration

Practice: Login Component

A login form is a Client Component: the onSubmit handler runs in the browser, so the file needs 'use client'.

Task

Create a login page component LoginPage (export default). Add 'use client' at the top of the file. Return a <form> with an email field (<input type="email">), a password field (<input type="password">) and a "Log in" button (<button type="submit">). In the onSubmit handler, call event.preventDefault() so the page does not reload.