1.1.0-patched-73c282e27eb5ede717dff8656410328bf8c6d99d • Published 3 years ago

@divkitframework/react v1.1.0-patched-73c282e27eb5ede717dff8656410328bf8c6d99d

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

DivKit for the Web (React way)

React component wrapper to render DivJson, using the @divkitframework/divkit module.

Main doc.

Installation

npm i @divkitframework/react --save

Usage

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.

Important: Configure your build config to minimize the result code size

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

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 | Чат на русском.

Twitter