RE

React

@zag-js/react

The react wrapper for zag

State Management
ui-machines
state-machines
zag
react
use-machine
hook
@zag-js/react
State Management
javascript
npm
Stars
1
Weekly
0
Open issues
0
Bundle
~60 kB

Installation

npm install @zag-js/react

Code example

import { create } from "@zag-js/react";

const useStore = create((set) => ({
  count: 0,
  inc: () => set((s) => ({ count: s.count + 1 })),
}));

export function Example() {
  const { count, inc } = useStore();
  return (
    <button type="button" onClick={inc}>
      Count: {count}
    </button>
  );
}

Pros & cons

Pros

  • Actively maintained by Segun Adebayo <sage@adebayosegun.com>
  • 0 weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~60 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 0 open issues on GitHub

FAQs

Alternatives & similar libraries