{"name":"@xstate/react","version":"0.2.1","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"},"bugs":{"url":"https://github.com/davidkpiano/xstate/issues"},"peerDependencies":{"react":"^16.8.0"},"dependencies":{"xstate":"^4.4.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.0.1","ts-jest":"^24.0.0"},"_id":"@xstate/react@0.2.1","_nodeVersion":"9.11.2","_npmVersion":"6.8.0","dist":{"integrity":"sha512-jek/AwxUQkNcrySaWrGb9IPuYHmg6pl3cCpMWEKxgqYAFfL/d4M5y+mmX9dyzZREOE7pY+kwaM99/ucGtOjKsw==","shasum":"972a45dfd98431ec6901431656419f5f5b206ce9","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-0.2.1.tgz","fileCount":4,"unpackedSize":7428,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcr/P8CRA9TVsSAnZWagAAXR0P/R6hBGNDGkLdjFvodaKJ\nA6vfz2Ol4D3OgHGQowo0sTwiZB5U5YescJ7/+pNXitvhBOzN2cUWtY+hQ6zD\nXEbN2+EyG1tm3uTrB86uWRg6XqOuHLcQIygEvAZAbhrb9NokP+CZ73x1yNwZ\npBwzD5VDL+JqNhhAgOfW1ns4dAeCjkBHWqGv/fMBYf/7YJQzfHzq0dwMgvdk\nnym/yRxQ8jbp/SqFdivfwpw7eGHJh2zCmV/Cua8JdzsxPX7GyqXgGN23p2hk\nzR0l97C6ySPeZaKvwis9pGnxyaTcar8Wv5idMjAxkW4ZmwWHgqL6nNRd+oC/\nCV+1n05dxICen1v+DsEl6y4alhkbF0fgsqPwbRuEROl73cQ6O84jgcYlOGhy\nBFLkMcQ6u5YLFwmypCxlV5slTpbs2PWNwrW80YTruYm75oxv8THKpOYKDPXH\n/AnaR5HkzdHXDisb3N1dvnOpHCEVII2BZw2eYwcveS6sSDr2Gym7LfZFBWQs\nYaGvx4WnNwAYohJx3rdx9hgm8j0/ThZSXRAoAK4tF1Z6ZiuqNAvniGZNpyHh\nFMnSHSgG5pgGDkH55BA7J4tyalHmrkTnA2kvREDDTUw/rOFgSq4KdbqEW1o2\nme2O3rd6oM+aRJwyoQ8zASFp5q08uy1QOI6jyeOab4sOiAr9uUA8Rjz2pBQ4\n0jxQ\r\n=eQZG\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCEi3hl8Vfdw6QIC0QuAiCfgNKCzpgvx3xqATNRcGKf2gIgB4NZxWroZeSWp7f6/nN2TEAZz6HR9B/e98IaPppm2AM="}],"size":3090,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-0.2.1.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.2.1_1555035130865_0.42533116929542336"},"_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":1555035130964,"_cnpm_publish_time":1555035130964,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}