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

Practice: Login Page

A component with useState and event handlers (onChange) must be a Client Component, which is why the file starts with 'use client'. The input is controlled: its value comes from the email state, and onChange updates that state with every character typed.

Task

Create /app/login/page.tsx with a form: 'use client' at the very top (useState is needed), export default function LoginPage(), the state const [email, setEmail] = useState(''), inside the form <input value={email} onChange={e => setEmail(e.target.value)} /> and a “Log in to the network” button. Add basic styles!