x-shard-react
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

x-shard

GitHub

React bindings for x-shard.

yarn add x-shard-react

Showcase

import { createEvent, createStore } from 'x-shard';
import { useStore } from 'x-shard-react';

const $main = createStore({ counter: 5 });
const incremented = createEvent();

$main.on(incremented, (store) => {
	store.counter += 1;
});
$main.on('document:DOMContentLoaded', (store) => {
	store.counter += 10;
});

function App() {
	const $ = useStore($main);

	return (
		<button onClick={() => incremented()}>count is {$.counter}</button>
	);
}

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i x-shard-react

      Weekly Downloads

      0

      Version

      0.0.8

      License

      MIT

      Unpacked Size

      6.39 kB

      Total Files

      6

      Last publish

      Collaborators

      • arch1i