{"name":"@xstate/react","version":"1.0.2","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","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","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","ts-jest":"^26.4.0","typescript":"^4.0.3","xstate":"*"},"_id":"@xstate/react@1.0.2","_nodeVersion":"12.19.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-7UfMjnASK5GjRBM8a4YmW0aMdW5tQQRxSHkihxhTHv6z1ieGatBfOkRu9WNndgQoWN9Ns41jxDU+n4GcJ1oAmg==","shasum":"e0d9e4f2c8125f6a05056e163262776d9d375e8c","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-1.0.2.tgz","fileCount":36,"unpackedSize":66416,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfo/duCRA9TVsSAnZWagAAv9kP/3plEOn/0D0D4ht4CGFU\n5DOwPQv9UtKI7czwIGNdqE0+8kfXpRnz+gy5EDUOMrSYSfMoA6XNWJ7bRsB0\nrzx2b+K/xF63GPF7Yb6DzDm0rHjy7iF+Ph8h0x1SkFQHqHiUOy57xDqsEiww\n607yHRDdWCoZZeFV1MBitbcuqwsZj131rqkAy6+9g4v1iYDkbg0TokN59FZI\nbW8lY8pVbBJBTwouPHdFJjxJacGrv9MZHd3tgOwhqO8xxU4TZFTrZty/ixdI\nzqhjZBgzZqxIJ6Ym1a8LhsuDS4VVOqGm4j4jSdrj54x3yQ/lizxun39U/Iij\nkPqD17AFwFpWnTF9y12So7/N1E59J1S4kF+m+sysSWvNNOH5eAspcpum/249\n5Lb4ItHsi8Az51+dqSNiu4wYGPh1HMyawUtxUZwTnHVEU/7GI3suJgyE5/MI\ndow/tAQ2kQMeZYfATIB+P6kfdy5ZH7jtnVgRnZ6PIiL36r1125Aqzw0tWDL+\n87p2wYxgYnkoSDaRzncmqv4JNntUqGZtIbdMh/AnU83DcYrkB975i4FRONGb\nrRJOr2AkJyDKpmybwXtv+9UmcbTN/t6eJg7jMeV+MeERUvrJ8tCZS+0T7flE\nVqywvLRLEteQxJN9khg2ZJ/XRpdzrz28tVM97f25KxMiKNwFus/fRp7ZPEcN\nvduM\r\n=3GqD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDNQ+BS7XruvKdYPiPOmTqLsPrY7uGZNZJHYUslN3hoJwIgQlxFeW7t2IrSsTaOx4z9UY6j48UQp950toG8ykU2UfI="}],"size":13045,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-1.0.2.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.0.2_1604581230181_0.23272018485458257"},"_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":1604581230294,"_cnpm_publish_time":1604581230294,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}