Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 545 Bytes

README.md

File metadata and controls

29 lines (22 loc) · 545 Bytes

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