{"name":"@xstate/react","version":"1.6.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.30.0","ts-jest":"^26.5.6","typescript":"^4.3.5","xstate":"*"},"_id":"@xstate/react@1.6.1","_nodeVersion":"14.17.5","_npmVersion":"6.14.14","dist":{"integrity":"sha512-M3b32nGhA0K3N6NrYKAMXx3dgGlLmuZfJU/EsZT04kQyVbWSiT3z7p9rdPisQyaQYFUwdqspQZ68wRNWbUkfVQ==","shasum":"7e920520ba54d3c2ade55639761d7ca2c25c4900","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-1.6.1.tgz","fileCount":55,"unpackedSize":110122,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhLijTCRA9TVsSAnZWagAAATAP/2OJIQf+Sv6DJ7aW0qoz\nLYlJ8u3x3nAFQQUzq6Pq6f6QkJI4y4xbBhgYIQqD8y/4FVRHUQoq4S9VBVMz\n8VQDlj/hdKJTSI/dQ+vxLC2bdMWRRmm80YgrDkf17TfbFmgb5p6ASzRLp0DN\nQSRWxo4679kVkjT6h3RsX2w7BxCbM1TncZZ1JBO1ic2tY0/nSWfQIlWwneuK\naDVyvViLm9SnngMmGLmM8nel4s85r66VR1oaKQ1T+CIFzilH8ulHml2meJzj\nc+BXGiZ7d2wOCMCI9QMlrLDINLQjD9JvOY97Y3qp7/ZmPk0YnK0uL6HynJjp\nrERQwPMs1BbuM8JlflRQtsWG+ewyMLR174iT7YERlOjnDCyq2f/nGtF3NLpW\nvH0FymAkKEd00U6KRe1A/D561VQEu3hWxqw29R4sON1ZfrMYGcKheERIkenW\nl97rc6S8dujv/aokNyrY7OtSSFC0kYdd18fbm+1SaCjcwLRufyYFbe63z0cS\nrhMDbDzHLmdR5yY4IyCDPtdnxOzD0tMTx2ThohMnwMRHkmVM7ggXdRnQ2uds\nHSV6KpoDAoV1CMygE+h5Qu8+oCdIUi8YCrHUrTZRyHLU6oThT36sKCtj50NM\n1qxENCMfqWrL5pzn7eKvb/AT4UCxZ/DaQcRq8ZRpdtmMgX5PG3bcmikmLU5A\nBjVz\r\n=LNLY\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCu7N2BWNjCMOo2SmRbq4o8KmaK+kRLCbovkpCBHdSccAIhAKIfE3ODMlPcUTuhhoVc0vB2q9ACXo+QKP/wh/+yHzUP"}],"size":22757,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-1.6.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.6.1_1630415059570_0.37074495312378497"},"_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":1630415059704,"_cnpm_publish_time":1630415059704,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}