Skip to main content
InterviewHubPRO
Section Overview
Q49

Question 49 of 407

General

12%
React Core & Hooks (407 Qs)•General

How you implement Server Side Rendering or SSR?

mid LevelCode ExampleSSR & Hydration

React is already equipped to handle rendering on Node servers. A special version of the DOM renderer is available, which follows the same pattern as on the client side.

jsx
import ReactDOMServer from "react-dom/server";
import App from "./App";

ReactDOMServer.renderToString(<App />);

This method will output the regular HTML as a string, which can be then placed inside a page body as part of the server response. On the client side, React detects the pre-rendered content and seamlessly picks up where it left off.