{"name":"@xstate/react","version":"1.5.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/main/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":{"@rollup/plugin-commonjs":"^17.0.0","@rollup/plugin-node-resolve":"^11.0.1","@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.6.3","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":"^2.35.1","rollup-plugin-replace":"^2.2.0","rollup-plugin-terser":"^5.1.2","rollup-plugin-typescript2":"^0.29.0","ts-jest":"^26.5.6","typescript":"^4.3.2","xstate":"*"},"_id":"@xstate/react@1.5.1","_nodeVersion":"14.17.1","_npmVersion":"6.14.13","dist":{"integrity":"sha512-DJHDqDlZHus08X98uMJw4KR17FRWBXLHMQ02YRxx0DMm5VLn75VwGyt4tXdlNZHQWjyk++C5c9Ichq3PdmM3og==","shasum":"60817e60e54e338b8e7c3e51bfa4cd3babebdc7d","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-1.5.1.tgz","fileCount":55,"unpackedSize":106285,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg5JbxCRA9TVsSAnZWagAAzh4P+wVLCcyxx13czd6n6mKj\n3iQMClfYQoPG7eJoX3LR/+JMO+f/FCnfNAvreDN39zDG/L4EvXZRsArL9JsT\nbc8/FnHiK/szEfy5KinduACqkJvUzk0eRel1taCLkZ6JaTiliFwE+vTBbXLL\nily3AvhQOwkurbK9PWkQLXRFYd0qed64CeGGVBrp8EHl94eZdgfpyBjlbhcl\nwm2Sz9Sisu2wFokWxzzwTu8+88iOdd6F/gAiz/rleUOuNd8emMdh5Zys0ona\nBNm+1Ol2VVdavRkn7qhJQ7Q8VyYk5h/nhx6yhE5Z/vVzNUX9eCm5WZVpz7uY\nX/kV55TBo1tHOa+jYuIct07I0SYSEAKjoUN1up0A7fcpLgtFhcStqmDjrCxN\nVI/7Qa5sDqu1YK+y2E/bt+0DfBU7dGyShwsuSMjwGIaOGID9oxbE6ZFA2DUr\nxjK7w6p2kXfxqLLER5AExMWgYOu9YfBAX/UcGcRDJ6z2NQ+s11NX9FCtwaVj\nICW1U+p6dbnifPx7rbQ4/QDk7WqmOMwgJCCTYmj+C0lLWviUsvSEGtzSMA5H\nxzof7OTX+W7xquVz1+p097PyZP8PIFtmMfgZ37Muc7i+dAchtg7Xj2E9DuSj\nasZIg5qbPN4D3ifjA/YrK+ImRa9Ek3QS92BQ5/ufTFPh05rdK4OnKF2UwSpy\ny6Oo\r\n=+N4i\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIG32w2uaLKKz/g0IhJbdIUAN3DJPcTl8F5iJc1/tBW9xAiEAy+/VvLaw7lgr/WJlZSgVP30gFJIgWfpSMf9FmElPKbA="}],"size":21697,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-1.5.1.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.5.1_1625593584960_0.5223634492397218"},"_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":1625593585098,"_cnpm_publish_time":1625593585098,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}