{"name":"@xstate/react","version":"1.2.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","module":"es/index.js","types":"lib/index.d.ts","sideEffects":false,"directories":{"lib":"lib","test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/davidkpiano/xstate.git"},"scripts":{"clean":"rm -rf dist lib tsconfig.tsbuildinfo","build":"tsc && tsc --outDir es --module es2015 && rollup -c","test":"jest","prepublish":"npm run build && npm run test"},"bugs":{"url":"https://github.com/davidkpiano/xstate/issues"},"peerDependencies":{"@xstate/fsm":"^1.0.0","react":"^16.8.0 || ^17.0.0","xstate":"^4.11.0"},"peerDependenciesMeta":{"@xstate/fsm":{"optional":true},"xstate":{"optional":true}},"dependencies":{"use-isomorphic-layout-effect":"^1.0.0","use-subscription":"^1.3.0"},"devDependencies":{"@testing-library/react":"^8.0.9","@types/jsdom":"^12.2.3","@types/react":"^16.9.11","@types/react-dom":"^16.9.4","@xstate/fsm":"*","jest":"^26.4.2","jsdom":"^14.0.0","jsdom-global":"^3.0.2","lerna-alias":"3.0.3-0","react":"^16.12.0","react-dom":"^16.12.0","rollup":"^1.26.3","rollup-plugin-terser":"^5.1.2","rollup-plugin-typescript2":"^0.25.2","ts-jest":"^26.4.0","typescript":"^4.1.2","xstate":"*"},"_id":"@xstate/react@1.2.0","_nodeVersion":"12.20.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-/xJJ5UEGZmXKWvhBbSd/yIycFOTNM7crm3J/WHdjrA0JkkXLrIibr+gRdk9Frnsu4fyndFX9fxmIEYj0m8yXFQ==","shasum":"ad1b7b026968d7449de9034fc5c200411c1fdfc7","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-1.2.0.tgz","fileCount":38,"unpackedSize":76960,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf3jk7CRA9TVsSAnZWagAA6kQP/iq55xRyQdaHvWD3bOFU\nTi24qGagdfQQN6Vz135vu2JioncJ/dEkcEOEK4vE3wqEa97pedQQzkICTKHA\nwtzpsLGY4bI63YkfBnNnrBXmgMUM7Si4d/VjMPygCbt4Oq1gTCNqWwLGAVum\nN3FR5vS7oL8P5fboCIFuoEkweCVrNfBmm4X/bNFYmbePzVJKErVR6w0Y+zlH\nQSxnKsbUttuTIM9CSx6EnGR2eiqRukCVTcSN4V8XHzHVrtwBMIFSgHkhgaOc\nO+8A5e4J+54tO1IwYeRPeGPtxxW4yO1lv/D8mDkatnIMbrtE5+7ADSiLh/Fd\nBXb61ZYBHRQVZVoWVXnv144Lrib1fCOX+s+f+fwnsimb3RfHsni9JDY42abo\nkBjNTvbHuLqAjGRjuWg/OtZrKGk8dmk2KphWqwHXb5ixWPe/ThT/efpbSU0z\nCeAoMBpVPi7EVnBVlHb3xuSR+n2/gks/0swcqs02LtfPNKtMtL/v80uhu+m+\nIH83zr48qoW9vRlw8x8AjvlzucXXmdKWih3i2So0xHJtv3Zq+fed4f1NvPFk\nDKX/4HKSwGc65exVO21k++0Fyb9bcr+xTdKLTn6vcHZfXvf9x7DFHuInlY/5\nOZvlnvMEdL58bQ+nTWbyGCMdWy6uImDLVXdeXiPDc5moEuyP1L2rXBG2p/T7\nCGW3\r\n=IcYz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/fajx0Cp8/v+ghu4zZvNo72kP78AP6XzLJXg72Dd+cwIgCJWYhp7uhTw8Y45Ae9hZ+gqXfT943bsP47uuLlobN8k="}],"size":16081,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-1.2.0.tgz"},"_npmUser":{"name":"davidkpiano","email":"davidkpiano@gmail.com"},"maintainers":[{"name":"davidkpiano","email":"davidkpiano@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react_1.2.0_1608399163329_0.023965201650467005"},"_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":1608399163489,"_cnpm_publish_time":1608399163489,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}