{"name":"@xstate/react","version":"0.5.0","description":"XState tools for React","keywords":["state","machine","statechart","scxml","state","graph","react","hook"],"author":{"name":"David Khourshid","email":"davidkpiano@gmail.com"},"homepage":"https://github.com/davidkpiano/xstate/tree/master/packages/xstate-react#readme","license":"MIT","main":"lib/index.js","directories":{"lib":"lib","test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/davidkpiano/xstate.git"},"scripts":{"test":"jest","prepublish":"tsc && npm run test"},"bugs":{"url":"https://github.com/davidkpiano/xstate/issues"},"peerDependencies":{"react":"^16.8.0","xstate":"^4.5.0"},"devDependencies":{"@babel/preset-typescript":"^7.3.3","@types/jest":"^24.0.11","@types/jsdom":"^12.2.3","@types/react":"^16.8.8","@types/react-dom":"^16.8.2","jest":"^24.5.0","jsdom":"^14.0.0","jsdom-global":"^3.0.2","react":"^16.8.4","react-dom":"^16.8.4","react-testing-library":"^6.1.2","ts-jest":"^24.0.0","typescript":"^3.4.5","xstate":"^4.5.0"},"_id":"@xstate/react@0.5.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"davidkpiano","email":"davidkpiano@gmail.com"},"dist":{"integrity":"sha512-ln8BxucJHlS/PC3qReGL6v4pl5Tn2Vq2d5NmTuZnc6ejh30+NZsiVYm9YC+h/IfmYmPOo5GfDpqxTdMiHRmpcA==","shasum":"5eefc61e3cac1c187971c070e3642a4a26a58ed6","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-0.5.0.tgz","fileCount":7,"unpackedSize":14391,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3ujxCRA9TVsSAnZWagAAh6wQAJRuUTrRBCPMIyOFPekt\nJpEq16pIVcQmBOwNolx2my6SiQElKqKqR+OhY7+X3gNkoNhMg9HXCWCSVS0Z\nSdGAyUUBgo+IaZgcE2xxr0BbhqXRIHIOBi1eltMef9p3csMPQefJUvncKJfi\nK/IPBlgSNkrmvGgA1/iEuuT3SQTBHFyCS7WOi5AuJrIwfflauu6opNpLCGNr\no9yD1annVJoOOtnkNue9s57tgqz6R7m5NDs/3aevUPNgnTj8lknh4q2lsvQW\netBb753xTC4Vca/idzLiGBzPh3imtFGCykMimDrX2/1ly8eiSXO179PIZL0C\nw0V2fZl1XiLeM6Ip7J/T4fqNJ1yV9HnF6OVy6bskfiDwqb0Ls4jQ5Pe5oZJN\nzjOMBOdPSl8toO2s+hXdOeMNsDN009Q6wsk2qpXBgijWyIuip9DYzuZdh/ov\nwrYk1S97jVFO/p0u1NhLaKInRCatpTBa8e7p0y0IJEWsyoySKo9PeYcpjL1+\n5RTA5Pxf5mswtMo73K5wBHO2w6MBpupZP5ThlfQ8qcgs+sD2/RXNENYw7Bdj\n3RHOjKfSbXSP+7hZ1FL5q2F7FMRGbZMH+HAaU90bTf6eAgPXy3SahX1O8CUc\nBhRoxQY88tUlfiI8I0h9hhfGPfVFLIKV4ArRZQ8tCt2bKw6Z4fdTY0kQQvn2\nLGID\r\n=YpAG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1RvPwUynxa8NDU9pXTjBhYBrBpMypJiKGnUYA+p4zggIgY8LThCURW11i7FpcJPckNs0wvXhCX8pem0WFAFQYYdo="}],"size":4273,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-0.5.0.tgz"},"maintainers":[{"name":"davidkpiano","email":"davidkpiano@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react_0.5.0_1558112496204_0.9760318136090402"},"_hasShrinkwrap":false,"readme":"# @xstate/react\n\nThis package contains utilities for using [XState](https://github.com/statelyai/xstate) with [React](https://github.com/facebook/react/).\n\n- [Read the full documentation in the XState docs](https://stately.ai/docs/xstate-react).\n- [Read our contribution guidelines](https://github.com/statelyai/xstate/blob/main/CONTRIBUTING.md).\n\n## Quick start\n\n1. Install `xstate` and `@xstate/react`:\n\n```bash\nnpm i xstate @xstate/react\n```\n\n2. Import the `useMachine` hook:\n\n```tsx\nimport { useMachine } from '@xstate/react';\nimport { createMachine } from 'xstate';\n\nconst toggleMachine = createMachine({\n  id: 'toggle',\n  initial: 'inactive',\n  states: {\n    inactive: {\n      on: { TOGGLE: 'active' }\n    },\n    active: {\n      on: { TOGGLE: 'inactive' }\n    }\n  }\n});\n\nexport const Toggler = () => {\n  const [state, send] = useMachine(toggleMachine);\n\n  return (\n    <button onClick={() => send({ type: 'TOGGLE' })}>\n      {state.value === 'inactive'\n        ? 'Click to activate'\n        : 'Active! Click to deactivate'}\n    </button>\n  );\n};\n```\n","publish_time":1558112496436,"_cnpm_publish_time":1558112496436,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}