0.0.9 • Published 2 years ago

uwhen-sinuous v0.0.9

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

UElements

uelements provides a functional way of defining custom elements.

<my-counter count="10"></my-counter>
import { define, useState, o } from "uwhen-sinuous";

function Counter({count}) {
	const value = o(count);

	return (
		<>
			<div>Counter: {value}</div>
			<button onClick={() => value(value() + 1)}>Increment</button>
			<button onClick={() => value(value() - 1)}>Decrement</button>
		</>
	);
}

define("my-counter", {count : 0} (el) => (
	<Counter count={el.count}} />
));

Courtesy: swiss and sinuous