{"name":"@xstate/react","version":"1.2.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","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":{"@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","rollup":"^1.26.3","rollup-plugin-replace":"^2.2.0","rollup-plugin-terser":"^5.1.2","rollup-plugin-typescript2":"^0.25.2","ts-jest":"^26.4.0","typescript":"^4.1.2","xstate":"*"},"_id":"@xstate/react@1.2.1","_nodeVersion":"12.20.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-WNVUD0+HfgpwsyWGXfELMpHVQU0sIMgEcMI1HmBaXnONMx/IK3OjpTw0VE2sDVqNhUwRzdnSeKXGaplw8rpb2w==","shasum":"3f6eddbc4cc6fbcb33de6f46fbc15e374fb605dc","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-1.2.1.tgz","fileCount":38,"unpackedSize":76550,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf3+zoCRA9TVsSAnZWagAAVHgP/35ODwk7yOmVWTAYJ3Tk\n79OOM/RwwX8bTmU9dzaji6kH1be5grELgcGM23I3+Lk+I6eyxH/97TC+crle\nAlywH2sTsqiKqyTXh9iPVknRWG8bxVeembCCifysNLub59zd8DzDpwO0Ky/5\nrnH2qHFT5QBvwSQLNFEyuFnG6yh74pZ779qh+5s2IkeL+gm8VHu863j4KIWt\nMsLc+ri6sSdBPaQVpw47gCPBIgqz+q1UbvriJWEWbCAe7NTE2qMDLfPyposW\nygceEdYjRSauYaCp8ej9H9jb2trku7nosrLFJ4q9Phl5cYAlEzg7gEePZReg\n/wZtvO53PRv8NLvcplv/41qicdeGb5SvkBDi+omQRa4nXCEQ/W0jNBP2r9Y4\nz47crZWTNVhPIFq9uMzCzVTrKHh0QEkWHZUiqlSmmL1/D5cuhBW6M+rkBUSD\nHPf37fZyvPD7DrjdfovUtepaxqoS0rO00EN59K0tkHvBYOMCH9cHcmnV9u6a\nb8TY7R/1VvFbBtF2Us3Yp7Y2JfhkPD6Y4MkZZr+SMjhSXRUBNkwhn+7jukes\n3PjYWdUu/lz0OT4RuDHMyYqnSkQHDY4eYzPCeuIM94zr07dHRWRgUmv0g/5B\n2W/XFlhVGU/uoGh9jStIGlQFRadCItFcfFJsYZ4iSk2njGhj2LIbMd9eaCMk\nIsFe\r\n=m8Vm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDObP0nIdvdqjhCyPQ+xLhxH26fEjVNOosN+VR2ES/43wIhAPjVNHudqqdzmGYhvQjEV5BeLj+gfByaqZ2bia0rS3J3"}],"size":16184,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-1.2.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.2.1_1608510695606_0.8677181528409033"},"_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":1608510695803,"_cnpm_publish_time":1608510695803,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}