If you've started using the Next.js App Router, you've probably run into this situation. You write a component, add a useState hook, and suddenly you get an error telling you it can only be used in a client component. You add "use client" at the top, the error goes away, and you carry on without fully understanding what just happened.

That's a very common experience, and it's understandable. React Server Components introduced a new way of thinking about where code runs, and it takes some getting used to. But once the idea clicks, deciding which type to use becomes fairly natural, and the results can be a lot better: smaller bundles, simpler data fetching, and faster pages.

This guide explains the basic idea and gives you some practical rules for deciding.

The basic idea

In the Next.js App Router, components are server components by default. They run on the server, and what gets sent to the browser is the rendered result, not the component's code. That means they can read from a database, use private keys, or call internal services directly, and the browser never sees any of it. They also don't add to the JavaScript your visitors have to download.

Client components are the kind you're used to from traditional React. They run in the browser, and they can use state, effects, event handlers, and browser APIs. (They're also rendered on the server for the first load, so they still show up quickly.) You mark a file as a client component by putting the "use client" directive at the top.

The important thing to understand is that this isn't "server versus client" as in two competing options. It's a mix. A single page usually contains both, with server components doing the heavy lifting and small client components handling interaction.

When a server component is the right choice

Server components fit when the job is mostly about producing content.

Fetching and displaying data is the classic case. A product list, a blog post, or a user profile can all be rendered on the server without any client-side code. The same goes for static or mostly static content like headers, footers, and text sections.

They're also the right place for anything that needs server-only resources, such as database access or secret keys, and for using large libraries. If a library is only used on the server, its code never reaches the browser, which keeps your bundle smaller.

When a client component is the right choice

Client components fit when the user needs to interact with something.

Forms with live validation, dropdown menus, modals, tabs, sliders, and anything that responds to clicks or typing all need to run in the browser. The same is true for anything using React state, effects, or context, and for code that depends on browser APIs like local storage or geolocation. Libraries that assume a browser environment also need to live in client components.

Some practical rules

A few simple rules make the decision easier.

Start with server components. Treat that as your default, and only add "use client" when you really need interactivity. It's easier to add than to remove.

Push the client boundary down. Instead of marking an entire page as a client component because one button needs state, extract that button into its own small client component. The rest of the page stays on the server. This single habit gives you most of the benefits.

Pass simple data across the boundary. Props sent from a server component to a client component need to be serializable, so think plain data like strings, numbers, and objects, not functions or class instances.

Compose them together. A server component can render a client component, and you can pass server-rendered content into a client component as children. That lets you wrap content in an interactive shell without making the content itself client-side.

Common mistakes

Some mistakes show up again and again.

Adding "use client" at the top of large files just to make an error go away is the most common. It works, but it removes the advantages and makes the whole subtree ship its code to the browser.

Importing server-only code into a client component is another one. It can leak things you didn't intend, or simply fail because the code needs something only the server has.

Forgetting that third-party libraries may need a wrapper is a regular annoyance. If a library uses hooks or browser features, you'll need to wrap it in a small client component before using it in a server component.

And placing context providers carelessly can accidentally turn large parts of your tree into client components. Put providers as low in the tree as makes sense, or keep them in a small wrapper.

Trade-offs worth knowing

Server components can reduce how much JavaScript your users download, and they make data fetching simpler because you can do it right where the data is used. Those are real, measurable benefits.

But they introduce a new mental model, and some behavior, particularly around caching, depends on the framework version and settings. What was true in one release may not be true in the next, so it's worth checking the current documentation instead of relying on older articles. They can also make debugging a bit different, since some errors come from the server and others from the browser.

A quick decision checklist

When you're not sure, ask yourself a few questions.

Does this component need state, effects, or event handlers? If yes, it should be a client component.

Does it only display data or static content? If yes, keep it as a server component.

Can the interactive part be split into a smaller piece? If yes, do that, and keep the rest on the server.

Does it use a browser-only library? If yes, wrap it in a client component.

A small example to make it concrete

Imagine a product page. The page needs to load the product details from a database, show the title, price, and description, display a list of reviews, and include an "add to cart" button with a quantity selector.

The product details and review list are perfect for server components, because they just fetch and display data. The quantity selector and the button need state and click handling, so they belong in a small client component. The page ends up as mostly server-rendered content with one little interactive island. The browser downloads very little JavaScript, the data fetching stays on the server, and the interactive part still works exactly as you'd expect.

Debugging tip: read the error message closely

When something goes wrong at the boundary, the error messages are usually quite specific. If you see a message saying a hook can only be used in a client component, that tells you precisely which file needs attention. Before you add the directive, ask whether the stateful part could be moved into its own smaller component instead. That one question will improve your component structure over time.

Learning by migrating one page

If you're new to this model, the best way to learn is by doing it on a single page. Pick something with a mix of content and interactivity, build it with server components first, and add client components only where the browser refuses to cooperate. After a page or two, the pattern becomes second nature.

Wrapping up

Thinking "server by default, client where needed" gives you a simple starting point. Keep your client components small, pass plain data across the boundary, and be careful with libraries and providers. As you practice, the boundaries get easier to see, and you'll end up with smaller bundles, cleaner data fetching, and pages that feel faster for your visitors. The "use client" error stops being an annoyance and becomes a useful reminder to think about where your code belongs.