Back to results for “App of Apps”
Next.js › State Management in Next.js Apps

How does the concept of state management differ in Next.js compared to a purely client side React application, given the presence of server components?

Advanced

Answer

In Next.js, much of what would traditionally be client side state, like data fetched from an API, can instead live on the server and be refetched through navigation or revalidation, meaning you often need far less client side state management overall, reserving client state truly for interactive, browser only concerns like open modals or form inputs.
// Server component fetches fresh data on each navigation
// No need for a global store just to hold this data
export default async function Page() {
  const products = await getProducts();
  return <ProductList products={products} />;
}
Real-world example A team migrating from a purely client rendered React app to Next.js realizes they can remove a large portion of their global state management code, since server components now handle fetching and displaying data that used to be stored and managed entirely on the client.

Common follow-ups: What kinds of state should still remain on the client even in a server component heavy app?;Does this reduce the need for libraries like Redux in Next.js applications?