React component wrapper to render DivJson, using the @divkitframework/divkit
module.
npm i @divkitframework/react --save
import { DivKit } from '@divkitframework/react';
return <DivKit id="smth" json={json} />;
All other props are similar to the render
options for the @divkitframework/divkit
module.
For this, specify the process.env.IS_SERVER
env variable:
new webpack.DefinePlugin({
'process.env.IS_SERVER': JSON.stringify(isServer)
})
Where isServer
- current env, true
or false
.
SSR is supported. Make sure to pass the same props both on the client and the server.
Documentation. Medium tutorial. Habr tutorial.
Telegram: News | English-speaking chat | Чат на русском.