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

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