{"name":"@xstate/react","version":"1.0.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","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.0","_nodeVersion":"14.5.0","_npmVersion":"6.14.5","dist":{"integrity":"sha512-ew9h8I8CeKl3waS2HoPwUHC86p0ebTVFTJUl/bPg+BHsk1fOswgzihp9c6Hmf2G0AHwmK4RNyfty+NzfvInx4g==","shasum":"087dc403fc022a4da928612e963effb3fba36f7b","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-1.0.0.tgz","fileCount":35,"unpackedSize":56871,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfcohJCRA9TVsSAnZWagAARL8P/06jjR/XRRQf77jQqmAS\nlhJvlug5kxMSs+dVYbvl0xGCRGVRhtOD6Efgi/f/tlRYUmKjdmmF5FYw2Y30\n5T0lfriOOqHP53ofYiP/SvmK0nK0KHxkADr//n9YF/KVo8yv662zeSIzYrMM\nqD5yeB3sXZzWwPXpU9U08EuYG1J+8N/b5zDtKpb/3CM9z0v5euGQrYX1IE2V\nxYRVeFKJBEB2ChXOICW0LcuYKXlQwga+vOXoItAslIlfjo0jxXLHca+Q/cQm\nAWoQO3vNnGJQUsToFSA8g7eZ8PBmrj6NEgoMnX7E0r/IytpO9pxlL1f/jwfS\ndeCTchyL3M4imdtjKkYkiIP6RyI15nhA+UKGHs0YduFKOqJZBl/SQ9tBWhaS\ntBHgXM44ISzWJVAWJiAvAttlKR15wXTnINEMpDz/QU4HyyImlkuVyzkQhnNZ\nahEf7aD1qPeGY9479db+NpWKPesWvRHhL2VsavbGa9O+N6YokC9KMnq9aJt6\neoU7TyXbotZXB5TccNTcypU97hPrXULxLM/hWQaner3dFovj7IUmcfwXMkmF\nJFnxgCDynV2FlQYUfKJb4IbCxrWTfa+cS094kywUb9I59etuJHnKEmTf2wcV\nR5sniv1uixzbJHibzRFNQ81prh0u2J967AQqE0yrZilAIpZi71xXOEfNikBM\nEtnM\r\n=Tx9L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGPkHxp01ai28DZgKff4MmTS/yA4SbTPT7CA2FJnURIQAiEAkQ7wF08l3l3mWxe1dCM0CWKTwsjXiQiABNypFs12J08="}],"size":10541,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-1.0.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_1.0.0_1601341513095_0.4946307334167208"},"_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":1601341513234,"_cnpm_publish_time":1601341513234,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}