{"name":"@xstate/react","version":"0.0.3","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","directories":{"lib":"lib","test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/davidkpiano/xstate.git"},"scripts":{"test":"jest","prepublish":"tsc"},"bugs":{"url":"https://github.com/davidkpiano/xstate/issues"},"peerDependencies":{"react":"^16.8.0"},"dependencies":{"xstate":"4.3.3"},"devDependencies":{"@babel/preset-typescript":"^7.3.3","@types/jest":"^24.0.11","@types/jsdom":"^12.2.3","@types/react":"^16.8.8","@types/react-dom":"^16.8.2","jest":"^24.5.0","jsdom":"^14.0.0","jsdom-global":"^3.0.2","react":"^16.8.4","react-dom":"^16.8.4","react-testing-library":"^6.0.1","ts-jest":"^24.0.0"},"_id":"@xstate/react@0.0.3","_nodeVersion":"9.11.2","_npmVersion":"6.8.0","dist":{"integrity":"sha512-2CBNrlPMPBdhzX6yHR/Lux+v7x2osN+GwN5xucUdwTHZXW4noGQsBIp+eDlgmh/btEAcyrMI4Kt3K+080U9WcQ==","shasum":"dec36f2c3387bb33b9020be7b9d44ab96da620c6","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-0.0.3.tgz","fileCount":4,"unpackedSize":7167,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJckpSxCRA9TVsSAnZWagAA83gP/AqSJxEVzLGhpte7hjBc\nzLfK1YGEQCiqVQ1GeITV3WKfj1//U9qb1mI2ph0FW7Cn1UChHDf7Kq1hcfRP\n1nnIRTS8UayIhFOsHR7YHYYYP5L72NErQhCGFCNooUM0RUM3gNpRB+osHmue\nHL8HiG4IJ/f1TfAE8OzZgDB7GHvU6t/4I1id04dDUKjerXrGHaTjn0rBpqIQ\nCKAdvY0jTss9MEeUdmqhgE1aJN+65z41eT8rAJwLYR6TvoGL+OLYVdAYxghG\n/pIaEK9A46fQns7SL+HmTicASOtFlHq/fewKc0fEsEhNLwcJtEqRoZmPH46z\nS6caMP5iSWcm1AHouK3rSzW0bK1r5ZrzCxCxwkDQ7keS0rD/Kxs70al/gmde\nWEDJOJpGl1cXlq0aENlhnILJCqfyZKqKdgveMHyJX78mF3tQuZifzed/VLfs\nazmpEVNZ7AnfWW5TMNqiP/D5g0aTvo0lg+kAoP0/wp6YoJKbRyo2Yuevo3DS\nagj6Zjcd1MitZ4Bah1+9cG9bgQO5fU9JpcseupXlAuAgf7e39nVnYax2fVTf\nOyw5buu7LVQ0SA2Agz2/Q0d2Py5JJ9qmgNjEozyHrVfpOQKcrlz4JofQ1HIa\n6rJPAfUZuXgGJ33uZLMI4Fzvz0LeYbpzWtmOMmFcUscUdbp5pGO9NbvyhEI/\nahRD\r\n=l5wO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDTdyAF8KHkohrViB4dCPxV79fJfWefIBl08USnuXwTNAIhAIBLV5EmB65XsLYlOcIPcmjAp6fce1gNrM7YB44mesVa"}],"size":3014,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-0.0.3.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.0.3_1553110192867_0.7034467062895602"},"_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":1553110192972,"_cnpm_publish_time":1553110192972,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}