blob: 1dce3470948f62865d9effe5cb33000849917425 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import { createElement } from 'react';
import { render, hydrate } from 'react-dom';
import StaticHtml from './static-html.js';
export default (element) =>
(Component, props, children, { client }) => {
const componentEl = createElement(
Component,
props,
children != null ? createElement(StaticHtml, { value: children }) : children
);
if (client === 'only') {
return render(componentEl, element);
}
return hydrate(componentEl, element);
};
|