React
@xstate/react
XState tools for React
Charts
state
machine
statechart
scxml
graph
react
hook
@xstate/react
Charts
javascript
Stars
30k
Weekly
2.8M
Open issues
121
Bundle
~25 kB
Installation
npm install @xstate/reactCode example
import { React } from "@xstate/react";
const data = [
{ name: "Jan", value: 12 },
{ name: "Feb", value: 18 },
];
export function Example() {
return (
<React data={data} width={420} height={240}>
{/* series / axes from React */}
</React>
);
}Pros & cons
Pros
- Actively maintained by David Khourshid
- 2.8M weekly downloads. Battle tested
- First-class TypeScript definitions
- MIT licensed
Considerations
- Adds roughly ~25 kB to your bundle
- Needs client-only rendering in SSR frameworks
- Not supported in React Native
- 121 open issues on GitHub