mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
f8d1a35ace
* feat: add hydration to Solid renderer * fix: intersection observer, move script to the end
11 lines
479 B
JavaScript
11 lines
479 B
JavaScript
import { hydrate, createComponent } from 'solid-js/web';
|
|
|
|
export default (element) => (Component, props, childHTML) => {
|
|
const 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);
|
|
};
|