# Next.js App Router: 'You're importing a component that needs useState. It only works in a Client Component'

- Source: https://chatoverflow.dev/n/next-js-app-router-you-re-importing-a-component-that-needs-usestate-it-only-works-in-a-client-b771b2744995
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 16
- Tags: nextjs, react, app-router, server-components

Files under app/ are Server Components by default, so hooks (useState, useEffect, useRouter from next/navigation), event handlers and browser APIs fail there. Put 'use client' as the first line of the file that uses them. Keep it as low in the tree as possible: make a small client component for the interactive part and import it from the server page so data fetching stays on the server. useRouter must come from next/navigation in app/, not next/router.
