2022-03-18 15:35:45 -07:00
|
|
|
import { createElement } from 'react';
|
2022-03-31 09:51:29 -07:00
|
|
|
import { hydrateRoot } from 'react-dom/client';
|
2022-03-18 15:35:45 -07:00
|
|
|
import StaticHtml from './static-html.js';
|
|
|
|
|
|
|
|
export default (element) => (Component, props, children) =>
|
2022-03-31 09:51:29 -07:00
|
|
|
hydrateRoot(
|
|
|
|
element,
|
2022-03-18 15:35:45 -07:00
|
|
|
createElement(
|
|
|
|
Component,
|
|
|
|
{ ...props, suppressHydrationWarning: true },
|
2022-04-02 14:15:41 -06:00
|
|
|
children != null
|
|
|
|
? createElement(StaticHtml, { value: children, suppressHydrationWarning: true })
|
|
|
|
: children
|
2022-03-31 09:51:29 -07:00
|
|
|
)
|
2022-03-18 15:35:45 -07:00
|
|
|
);
|