0.0.0-alpha.1 • Published 5 years ago

react-ssr-checksum v0.0.0-alpha.1

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

CheckSum

react-ssr-checksum is a component to help re-render if client not sync with server.

Usage

Generate check sum code on server side:

import { getCode } from 'react-ssr-checksum';

const ssrText = renderToString(<App />);
const code = getCode(ssrText);

// Put the code in your html template

Client side use CheckSum component:

import CheckSum from 'react-ssr-checksum';

hydrate(
  <CheckSum checksumCode={code}>
    <App />
  </CheckSum>,
  root,
);

CheckSum component will auto check code between server & client side. It will auto re-render if not match.