uland-ssr

0.5.0 • Public • Published

🦄 µland-ssr

tiny island

Social Media Photo by Ben Klea on Unsplash

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>
`);

Readme

Keywords

Package Sidebar

Install

npm i uland-ssr

Weekly Downloads

87

Version

0.5.0

License

ISC

Unpacked Size

9.9 kB

Total Files

8

Last publish

Collaborators

  • webreflection