summaryrefslogtreecommitdiff
path: root/packages/integrations/preact/client.js
blob: 6ff40d2ae1c579571d4488c1aa27ae14d86317b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import { h, render } from 'preact';
import StaticHtml from './static-html.js';

export default (element) => (Component, props, children) => {
	if (!element.hasAttribute('ssr')) return;
	render(
		h(Component, props, children != null ? h(StaticHtml, { value: children }) : children),
		element
	);
}