{"name":"@xstate/react","version":"1.4.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/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.4.0","_nodeVersion":"14.17.1","_npmVersion":"6.14.13","dist":{"integrity":"sha512-Yt0jPwuPRmlx9IdJO2SM4TEhq04/qY6zUuJUQs2JzVjXcwxPrX+IKxvu2DRHgPvfx3hg17G3D8D264C9Y29Tbw==","shasum":"1c9fa4bce3be2e7ad8d44691dbcd0daceb670bd6","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-1.4.0.tgz","fileCount":51,"unpackedSize":103023,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg1eVqCRA9TVsSAnZWagAAcRoQAJci/tbwIw9SBBzRb9R6\nbbdvSRbEQ+Xp8It5/HdLc10Qz62sNvwBmgw+o6jIPfiBgQ0KKqzMgQ6PQu45\nysVvpruoceYvBUjb5h5MqfatnGb1Uk8/lIWhMsyCma2rG88cYJ3K0cvuXoKb\nbslbJ5dYUgkmlW//vK1IC2sk/Yugv9ZlOi3cYhbHEBnfdLExsqnsPT0IdUxH\nkfSRYr3wxwLl6mHN9SHxdEGRnYEwzMTPMUP9oywiiIT9Z/id+dmhHanq6Xq3\ngxq41soi1DnsWJyzTcL1TCR3wbxsjfrT0rQIIHbSPwc5cWllyHm61kLcYqUj\ndI4U19yPjZeb49wmfH0+M2YczYn7OCkT3k32XepLHrRmjbsXZtipuggICrlX\nseoV/QLSPKeMRWrU0fA5NLcxBuDyDIBo67l148upvfyaCcVDkFSwNT4qsa/a\ni97Jqxdr7ZgFqGHKMW+gb//sMEnYvtC4T6fAT03RZ7yVRdCsy6M7bEXVUvgC\nPiIgXzZlOkspiujHsTA0X3OOcIzRbYjbIT1o0xA8fYspBU/MehU6GEZXaqMC\nARWpb9VvFp4SEllXFHIJj37YXmffXZokCk2LHv2b3zJ2gV9IExtOX7kH6szt\nR3e0Ngu2kW4XNESLmF975Yb3C1pFmEQZiKl9ehn+F55c+79Lk0a6WNc4e+jj\n2q5a\r\n=BrWX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDpL5l4s2KgbwiStEQk7QOR9tljTN93G1dbt3ZBL0C1EgIhAOuxE2mrxuyb64HXKADN+NZXKZp70794Tswak2xhnKM/"}],"size":20978,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-1.4.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.4.0_1624630634321_0.5594167701553836"},"_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":1624630634552,"_cnpm_publish_time":1624630634552,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}