ac3e870280
* fix: renderer behavior with no children * [ci] Prettier fix * Force CI * fix: properly handle falsy values * [ci] Prettier fix * chore: force ci * [experiment] netlify ignore Co-authored-by: GitHub Action <github-action@users.noreply.github.com>
14 lines
524 B
JavaScript
14 lines
524 B
JavaScript
import { hydrate, createComponent } from 'solid-js/web';
|
|
|
|
export default (element) => (Component, props, childHTML) => {
|
|
let children;
|
|
if (childHTML != null) {
|
|
children = document.createElement('astro-fragment');
|
|
children.innerHTML = childHTML;
|
|
}
|
|
|
|
// Using Solid's `hydrate` method ensures that a `root` is created
|
|
// in order to properly handle reactivity. It also handles
|
|
// components that are not native HTML elements.
|
|
hydrate(() => createComponent(Component, { ...props, children }), element);
|
|
};
|