aboutsummaryrefslogtreecommitdiff
path: root/packages/renderers/renderer-react/client.js
blob: 64284a0b01909559c93bcbb3dfad9ff6b70c6f96 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { createElement } from 'react';
import { hydrate } from 'react-dom';
import StaticHtml from './static-html.js';

export default (element) => (Component, props, children) =>
	hydrate(
		createElement(
			Component,
			{ ...props, suppressHydrationWarning: true },
			children != null
				? createElement(StaticHtml, { value: children, suppressHydrationWarning: true })
				: children
		),
		element
	);