{"name":"@xstate/react","version":"0.7.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/master/packages/xstate-react#readme","license":"MIT","main":"lib/index.js","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","prebuild":"npm run clean","build":"tsc","test":"jest","prepublish":"npm run build && npm run test"},"bugs":{"url":"https://github.com/davidkpiano/xstate/issues"},"peerDependencies":{"react":"^16.8.0","xstate":"^4.6.0"},"devDependencies":{"@testing-library/react":"^8.0.9","@types/jest":"^24.0.11","@types/jsdom":"^12.2.3","@types/react":"^16.9.0","@types/react-dom":"^16.8.5","jest":"^24.8.0","jsdom":"^14.0.0","jsdom-global":"^3.0.2","lerna-alias":"3.0.3-0","react":"^16.9.0","react-dom":"^16.9.0","ts-jest":"^24.0.2","typescript":"^3.5.3","xstate":"^4.7.0-rc1"},"_id":"@xstate/react@0.7.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"davidkpiano","email":"davidkpiano@gmail.com"},"dist":{"integrity":"sha512-6LKbMCWPtLfKL7Ph8E781qoKmypSPGS5e7e+LkTK/nhRpFcj6n3MfCl96mNWsdYMr7tb8ISQDZcxI+Ou0BpurQ==","shasum":"36d2143ba0d979017efa3c9566894c32cf5de0ee","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-0.7.1.tgz","fileCount":7,"unpackedSize":15974,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdaDb/CRA9TVsSAnZWagAAMecQAKApRPW5y9/NfdS90GYv\nN7UPUIAfKLVafGjgw7eJSQF4KW0FiDibRiNOoGX4BdvNwrJ8pmcLbXa5InfB\nlKA7ANJjtFVE373SL5pp+/BArt848eEO66iMK4VHN29rd2/whwDaUxK6IBuR\nQou30gcWwKWgkGqfKVw+bQ6uBU746bvtbg3uxMqohLHWdhmfdDD+EbM89As3\nCPJKWFe5julGi715k8MHmikjK+1Up09iJDHn86v7PBNI7AJwV6haFjQ7/NXP\nZ16DcavF0KydbinlD8MrxqsGurPNBqTmccJumyaxP3JIn3qqC8r9FyoMViro\nI768PC5Rc+rcHnE5wB/RR7pOfKPVCLme3TKtViZMGWZHgPmHUJRrpjvbMbJ5\n8xCnY/yZW85r0tLkwaM+XKTEKYw50SEwLTRdCRdeeiQK2zSebiU5Kvr+72oj\nOf6YJvWTRZjET+CSPYjA1w8IXI3Nsy+jjsM+WRZ5Y2Y2mzSnj4nnHU37XU4s\nXBhki88978ViD8yWOvV88rr1gT9jn9BWdt4V78bRaDpBKeutK18AJr7xxVDZ\n+NlTJyi+6uYQfAJFMW/2K82esUv3rS+khU6SbtBz2Z33Z9U6ftonr4y/wQq7\n1oc3GfyNUuZAnCdXqzu0aKFrlgqCYOsh4L6w1bLVwYTlbIflP3Py3qNOWS9u\nzj1B\r\n=tTsA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH/fdDLJnj352kuYM/H3f2kdonfAWUrRYGvwbyjdZgWyAiEAiB83QtnFIzgfj5lUOR791qRhxsZCFZscqrAok2tZs+E="}],"size":5485,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-0.7.1.tgz"},"maintainers":[{"name":"davidkpiano","email":"davidkpiano@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react_0.7.1_1567110910853_0.6166068975583832"},"_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":1567110910968,"_cnpm_publish_time":1567110910968,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}