@divkitframework/react
v2.1.0
Published
React binding for DivKit
Maintainers
Readme
DivKit for the Web (React way)
React component wrapper to render DivJson, using the @divkitframework/divkit module.
Installation
npm i @divkitframework/react --saveUsage
import { useRef } from 'react';
import { DivKit, type DivKitHandle } from '@divkitframework/react';
const ref = useRef<DivKitHandle>(null);
return <DivKit ref={ref} id="smth" json={json} />;All other props are similar to the render options for the @divkitframework/divkit module.
Imperative API
DivKit supports ref with imperative API:
ref.current?.applyPatch(patch);SSR
SSR is supported. Make sure to pass the same props both on the client and the server.
Documentation. Medium tutorial. Habr tutorial.
Telegram: English-speaking chat | Чат на русском.
