hardSystem Design

What is the difference between client-side rendering (CSR) and server-side rendering (SSR) in React?

241 views
01

Understand the problem

Compare and contrast CSR and SSR, highlighting their respective advantages and disadvantages for React applications.

ssrcsrperformanceseo
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Stuck? AI Nudge Available

Get a conceptual hint to guide your logic without spoiling the final implementation.

03

Study the solution

The solution is waiting

Give it an honest attempt first — then compare your thinking with the full walkthrough.

04

Read the code

CSR mount vs SSR render+hydrate
// CSR — browser builds the UI from an empty shell:
//   createRoot(document.getElementById("root")).render(<App />);
//   (initial HTML: <div id="root"></div>)

// SSR — server sends full HTML, client hydrates it:
//   server:  const html = renderToString(<App />);
//   client:  hydrateRoot(document.getElementById("root"), <App />);

// SSG is the same server render done once at BUILD time.
export default function App() {
  return <p style={{ fontFamily: "system-ui", padding: 24 }}>CSR vs SSR vs SSG</p>;
}
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.