{"name":"@xstate/react","version":"0.0.2","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"},"bugs":{"url":"https://github.com/davidkpiano/xstate/issues"},"peerDependencies":{"react":"^16.8.0"},"dependencies":{"xstate":"4.3.3"},"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.0.1","ts-jest":"^24.0.0"},"_id":"@xstate/react@0.0.2","_nodeVersion":"9.11.2","_npmVersion":"6.8.0","dist":{"integrity":"sha512-Ehdd6C9qzNn2erWUyWuTZUwi/u0EIoKvNaAkunpfV+K55ZavgWzcYbPPAXp8rLs4HcOZOkMKvsl61LrdBoJ8yg==","shasum":"d903a644292645818f85de5b9a05a364f197b02e","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-0.0.2.tgz","fileCount":2,"unpackedSize":4744,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJckkWlCRA9TVsSAnZWagAAlRgP/RgtDpynffv+P+KFgKF9\na8EaSeUAjs68f9Lee809y1uSxzCoVNc/raLG8gXXEJQCVa5R6q6I1XJRJ8cM\nBpQCHKKMyA6ySetwpBPsvHIbOAg1GfP71U6PFt7jnfEZln0ufzsB7r+/tPLM\nWiphsa2Ir06RPkZRB0QaQM627CExx8pOyd7QWb0x8wUgBX8xcomb4f2492/7\n5CRYw1lQmwOBKPmDUtGgAujaWm1mBjuEkAWSaH4MK8IqIVwLFDOOdkcYUxQB\nEen1kpBAXO+vP5dd49EO7QOArRh4BSVOSYLbK+X4YzbAz1QzCq+WPE8hxeEZ\nXNIs9viXJOfAjBgAIIl+WWKnezm7+Dz3lpmMj88sxzzpofPLlYziVaZA4BYd\n1J1OV7EN14vexaIVpU0+jGnBZNHPA3QvvOA5onXLhPMi6TO2AjXu1157NCPV\nH6NNp0sUlBIaEdv85a9xhydamB4YWGhu8Yq1Pr60B1n9VqULHLIaIUg/bB/M\numRvigDwJjffDp7txHS6QD0JJFZD3ZMQaSkcMRExt2porQ8XqhVeX2n3ty6n\nm0jJp5MhaVIUwwFWHuCYoVjjQgIqf2EL9zwNUHXoKMGoTrmOxjQ6e5sJ8qFs\nih/UU1uONPgY/ERpe9Z16Q1+MBYNIa+3f0qCJGijtfSIpPeSCLO18pBJ+Rj4\nSzA3\r\n=fFwo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGxaLgMg9vcVxoAYLb3XxjQzVWO/1L6NQjkTDvXoSWtQAiEAqZgvjOWw2LeE6/52eMiaFzSs4/k88bY6PCJMuY3KjrM="}],"size":2009,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-0.0.2.tgz"},"maintainers":[{"name":"davidkpiano","email":"davidkpiano@gmail.com"}],"_npmUser":{"name":"davidkpiano","email":"davidkpiano@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react_0.0.2_1553089956902_0.9530129801599558"},"_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":1553089957162,"_cnpm_publish_time":1553089957162,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}