Files
4eb0da e59477edcc Fix audit errors
commit_hash:16c452a817109921410ca6ed977f3ba78a8b2dfb
2026-01-16 12:50:02 +03:00
..
2022-08-26 03:52:29 +03:00
2026-01-16 12:50:02 +03:00
2026-01-16 12:50:02 +03:00
2023-04-11 17:17:38 +03:00
2023-04-11 17:17:38 +03:00
2023-04-11 17:17:38 +03:00

Render DivJson on the server (SSR) and then hydrate it on the client

Install the packages first:

npm ci

Run sample

npm start

Steps for the SSR

On the server side, use the @divkitframework/divkit/server module:

const html = render({
    id: 'test',
    json
});

Then respond with this html.

To hydrate with html on the client, use the similar way as in the other samples with 2 changes:

  • Use client-hydratable module instead of client
  • Additionally pass hydrate: true option

The json should be the same between the client and the server.

Ya.Divkit.render({
    id: 'test',
    target: element,
    hydrate: true,
    json
});