Vue Vibes in React

$ npm install zenbox
Get started
counter.tsx
import { createStore, useComputed, useStore, useWatch } from "zenbox";  

// Types are automatically inferred from initial state
const store = createStore({
  count: 1,
  addStar: () => store.setState(state => { state.count++; }),
});

function StarRating() {
  const { count, addStar } = useStore(store);

  // Computed values that just work
  const score = useComputed(() => store.value.count * 2);

  // Watch changes like Vue
  useWatch(() => store.value.count, count => {
    if (count === 3) alert('Already 3 stars!');
  });

  return (
    <div onClick={addStar}>
      <p>{'⭐️'.repeat(count)}</p>
      <p>Score: {score}</p>
    </div>
  );
}
ZenBox