The term Modern SSR refers to use of Nodejs
in backend and Traditional SSR refers to PHP
in backend.
Wordpress delivers the static pages through pre-rendering using php to generate HTML
dynamically before sending it to browser.This means when user sends requests to a page, wordpress builds the page on the server using PHP
fetches data from the database and send the fully render html to the client.
Plugins like WP Super Cache or W3 Total Cache store pre-rendered HTML pages. This reduses the queries from database and store the pre-render HTML pages and makes almost fast as SSR.
Framework like Remix
, Nextjs
, Nuxtjs
uses Moder ssr. Therefore it uses Nodejs in backend and receives fully rendered HTML from the server, improving performance and SEO.
In modern ssr hydration is the process where client-side JavaScript takes over a pre-rendered HTML page and makes it interactive.
1️⃣ Server Renders the Page → The server generates static HTML and sends it to the browser.
2️⃣ Browser Displays Static Page → The page loads instantly, but interactive elements (buttons, forms) don’t work yet.
3️⃣ JavaScript Loads & Hydrates the Page → React (or Vue) reattaches event listeners and makes the page fully interactive.
export async function getServerSideProps() {
const res = await fetch('https://api.example.com/products');
const products = await res.json();
return { props: { products } };
}
export default function ProductsPage({ products }) {
return (
<div>
<h1>Products</h1>
<ul>
{products.map((product) => (
<li key={product.id}>{product.name}</li>
))}
</ul>
</div>
);
}