Client-side rendering
CSR
With client-side rendering (CSR), JavaScript running in the browser builds the page's interface. The server typically sends a basic HTML document and the application files, and the browser fetches any additional data it needs.
Also known as: клиентский рендеринг
What client-side rendering means
Open an account dashboard and you might see the navigation first, then a loading indicator, then a table of orders. With client-side rendering, the browser can receive the navigation in the initial HTML while JavaScript builds the table after the orders arrive. The browser paints the screen whether you use CSR or server-side rendering (SSR). The difference is where the markup for the content is produced.
What happens on the first visit
The initial HTML usually includes a place to mount the app and a reference to its JavaScript. Once that code runs, it creates DOM nodes for the initial view. If the view needs data from an API, the app can render a loading state and replace it with the results or an error message. Later, an action such as sorting a list already in memory can update the DOM without another network request.
You don't need a framework to see the mechanism. In this example, the HTML response contains a paragraph placeholder, but the message itself is rendered by the script:
<main id="app"></main>
<script>
const message = document.createElement('p');
message.textContent = 'You have no open tasks.';
document.querySelector('#app').append(message);
</script>
When to use it
CSR is common in signed-in dashboards and interactive tools, where the view depends on the current user and visitors spend time interacting with it after startup. The app files can be served from a CDN without generating HTML for each visit. That doesn't remove the backend's responsibilities: an API that returns account data still has to check whether the user is allowed to see it.
Pay particular attention to a first visit on a slow phone. A large bundle takes time to download and execute, and an API call that only starts after startup adds another wait. Route-based code splitting can keep code for unrelated screens out of the initial bundle. For public pages, check what crawlers and link preview tools actually receive: some execute JavaScript, but others rely on the initial HTML. CSR doesn't make indexing impossible, but it makes discovery of the content depend on a rendering step that not every crawler performs.
How it comes up in interviews
A common question is whether a single-page application has to use CSR. No: SPA describes how navigation works after the initial document loads. You can serve a server-rendered first route and still render later routes in the browser. Hydration is another distinction: it makes existing markup interactive, whereas a client-only render creates the corresponding DOM in the first place.
If you're asked to debug a slow CSR screen, look at the network waterfall and a performance trace on an uncached load. Check whether the delay comes from downloading the JavaScript, executing it, or waiting for the data request. A smaller bundle helps with the first two; it won't fix a slow API response.