Awesome
🦄 <em>µ</em>land-ssr
<sup>Social Media Photo by Ben Klea on Unsplash</sup>
micro land SSR, is µland API for SSR / DOM-less environments.
It allows using same components code on the client and the server, producing html or svg streams.
This module also exports uland-ssr/async
, which is based on uland-nofx/async
.
📣 Community Announcement
Please ask questions in the dedicated forum to help the community around this project grow ♥
API
import {Component, render, html, useState} from 'uland-ssr';
const Counter = Component((initialState) => {
const [count, setCount] = useState(initialState);
return html`
<button onclick=${() => setCount(count + 1)}>
Count: ${count}
</button>`;
});
// basic example, creates the expected output
// minus online events (would need re-hydration)
render(String, () => html`
<div>
A bounce of counters.<hr>
${Counter(0)} ${Counter(1)}
</div>
`);