* feat: pass "client" directive to clientEntrypoints * refactor: remove hydration warning suppression react 17 * feat: remove hydration warning suppression react 18 * chore: changeset * fix: change metadata to options bag
18 lines
472 B
JavaScript
18 lines
472 B
JavaScript
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);
|
|
};
|