{"name":"@xstate/react","version":"0.1.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"},"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.1.0","_nodeVersion":"9.11.2","_npmVersion":"6.8.0","dist":{"integrity":"sha512-syvrYWhs27tIKw1aYsF7+y8YZcqbzrhxg6qp4oE3019R7lF6B4ZWf8LY/nuScoeFUgcGMOwiy9dIxbCj5oHfNA==","shasum":"d69910f9a5bc3ce2391413446c8751ea5627b83a","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-0.1.0.tgz","fileCount":4,"unpackedSize":7420,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcl6S5CRA9TVsSAnZWagAAWAcP/A9r8wxLd8wg7KDFYCc7\nDOIB/G1B4yzDN3fa4+gNiL1rNJ3C9zuDV+azOn9qQ6iwFoT6HhIEZGS7yKCB\n+RY2GuTY7PKFNcvOe7fOd+xWPRQFK9o4DnvWwKnBvG5Ilgcko24n3T6i0OIZ\npM2+/R38dnHU/yl24AnfupcgsQZZsIPpd/x3uVVgaWSQIH4h6h0LXbPP96TS\nVZHGEer4UOQ4e1c3t+sa7iI3yfKic8w1Ab1SYgjE4SFhk5qCmOtpCSAI6fDo\n2KyO1yjPJ/V3jAbGOWImwVs4TIu80kKyVnEgyh1RIax72fdFdiyoFRNbjXWt\n49QyoDR6/Lej/lgz7wCrbXjECUB6NiOGeJcJ1U9u04okTUh05I9PSAcQSarw\n2F5NvMqtgtv8hBgbtHPOucc0+tv/Z7r9czRHLwK3QttDGhnTSM8EvVFWSZe1\n6HeFGDcKgNTWoyI37j342agq1AuO2w17tsPNn79+/33+WzeG8e0c+KevPZiJ\nz0o2x0ASNIgo6gJCJwKEGriH/7xKqY9J3ubo8UmjafsGIl6hQH43nMJDIavy\nJY+d7uVs2SSHJSjEZy494eBJCLKUgu4OifIluvw/OS3XTJPR5bDnOkh4BtD6\nirLCH0XvCnT/bbQjaVwrjl4aDn+nnh2STgLd7ewGI6b5QUglaBzcsF7nn+Fw\ntjx9\r\n=vrwM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG96gR9YG5o68NSoAdUQHqHKAtso5PNn5mWNzdpwNl+2AiBy7XVDgZSFcIDaObrMExgELoeIXMGfZmoDtkHZX/iC6g=="}],"size":3099,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-0.1.0.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.1.0_1553441976174_0.28382312897018824"},"_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":1553441976287,"_cnpm_publish_time":1553441976287,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}