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