{"name":"@xstate/react","version":"0.8.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/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.6.2","xstate":"^4.7.0-rc1"},"_id":"@xstate/react@0.8.0","_nodeVersion":"12.4.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-cN9YZr8eh0Pp28qID55BuYyvUBA88RUjhHF9iZGnhnIHoviXQ+Ya1yewz1+Qvekyti3aiggtVQny6oDqlDNzYg==","shasum":"7435f949d1211bdda61569f890801b05322385af","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-0.8.0.tgz","fileCount":5,"unpackedSize":15126,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdstE5CRA9TVsSAnZWagAAfZYP/1Kq3Vix5heK+264FWOs\nP5DcJvYThk7o9lOAvO2b6QNwmKa8sZWHJv21lWwavd1jF5eCdSf1iG5fAKWq\nFyDYV4TZa/wUk1Uz03hspOsWu+YqTvqpkuckQgiSQ/xUS11XWOfudS0JYhrl\nysEgkG/WVsnNVELnOFrERm/cG3snkHwnSvg3mzxX0ugVVM4zg984uQq94I2h\ncSehO6KmSOAyUY7fhJPEebjt6+gcaCnBR8Wel+CevXsnFVr6BNZ4N846rYrp\nvt4KLZvrO0Z542LT3FzJUkmla6/7mxapXpCHbOGyTqXyQ/+Pm03JX10RFgDC\nUoVIKDEG1o8NVPaJRXr/kLYX3hKQKo75NDQcfyIhC/XLRz5/DJPPbNOLE9+i\nE7jR+H3+I9mGGT2KF05CJqf/CFyO7WEjvNtlq4Lw8sKCa9QIXzd2exJ0t4Xi\nepGTYxQJ/FLwI3buHaxUly1dDy5Lvu8OAztNGOR3aDdh8KsUmIrYXioANbot\nTbvW7X4YW6LuzIKlBy5lrK1/TYkYs6GutHxoRuNPzfGYN+JdI4/zI5xAW2is\nWCZ53qOAzvNA9lTg5l045mxrXKDlOxhLdE2zg/53xW3NyoukpOBkpaPjPwaq\nb4wV3e4F4v9hgV3VFaMdO1p+6k3pC+QDexXcwq0EBnfrE86+rZZziTDdPdG2\nY/XE\r\n=MOCw\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCIDTMQ1krVa0TDW3R5OZXjwLRwl/xV+lYQ59OTWNjNrQIgG9JlG8rtuud9eoiXivUnvU6sUPYpTvsZP8WMR3sA0WA="}],"size":5086,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-0.8.0.tgz"},"maintainers":[{"name":"davidkpiano","email":"davidkpiano@gmail.com"}],"_npmUser":{"name":"davidkpiano","email":"davidkpiano@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react_0.8.0_1572000056944_0.8590727430954483"},"_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":1572000057105,"_cnpm_publish_time":1572000057105,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}