@yawn-framework/runtime
v0.1.0
Published
Browser runtime and hydration for Yawn framework
Maintainers
Readme
@yawn/runtime
Browser runtime for Yawn framework — mounts and hydrates components in the DOM.
Install
npm install @yawn/runtimeUsage
import { mount } from '@yawn/runtime';
import App from './App.js';
mount(App);
// mounts into [data-yawn-root] or document.body by defaultCustom target:
mount(App, { target: '#app' });
mount(App, { target: document.getElementById('app')! });Hydration
For server-rendered pages, use hydrate() instead of mount(). Currently performs a client-side re-render; incremental hydration (DOM diffing) is planned.
import { hydrate } from '@yawn/runtime';
hydrate(App);Mark the SSR root in your HTML with data-yawn-root:
<div data-yawn-root><!-- server rendered content --></div>API
| Function | Description |
|---|---|
| mount(component, options?) | Mount a component into the DOM |
| hydrate(component, options?) | Hydrate a server-rendered root |
