{"name":"@xstate/react","version":"0.4.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","directories":{"lib":"lib","test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/davidkpiano/xstate.git"},"scripts":{"test":"jest","prepublish":"tsc && npm run test"},"bugs":{"url":"https://github.com/davidkpiano/xstate/issues"},"peerDependencies":{"react":"^16.8.0","xstate":"^4.5.0"},"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","typescript":"^3.4.5","xstate":"^4.5.0"},"_id":"@xstate/react@0.4.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"davidkpiano","email":"davidkpiano@gmail.com"},"dist":{"integrity":"sha512-LOoTjtEjaZ31XKGtm/RDBN2VZbgpUArw6AcZ0atcKU47i09i2HzSB95G+4QC5SuQ8HPcROot40TNy45/cipibQ==","shasum":"82992a46ebde2d99cbb803d269e15ad7df3cc0ac","tarball":"http://registry-npm.ywwl.com/@xstate/react/download/@xstate/react-0.4.0.tgz","fileCount":7,"unpackedSize":14380,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc3efLCRA9TVsSAnZWagAAFo8P/Rz66gUoM4RDhnHeJQvM\ntGTpK3E0LN+2TTCxNASua/jQUcap2EgrEbsluX1PloJrL4SJJNVwdQCSRRJK\n3SCE5v8Nea+Mb9dmPbquF3pR26yE4A7/gwUaswpaBvAD0xevUtWy9rWidsyd\nHCgvwf4RASs5V/3TcAKc+t8BVDRQ/gUVOhdfp6D8NUZNHN4PrWRL6PqNqd9Q\nFBO1oCnohuLGy0dYZRLUG8VGPLTVMmBlCgsZ+5rdrO7GTHJYKdLxwPL+ONpN\nvo7p1PzINMj6A7Ruo6puwLpm7VFlvAUWjtjBG3cjwY0Avxpp79x4y7EvPzSf\no1J4K5h4k2GgAi9MmO6KsCNhJ9TnZ2DkdbGj85mam7GexUGrSjx4CRX0pIy8\nejQg9BlJ+YESZSuS/Mrcjf+OXPREwnudRF58ETGpfLwB2PR8tMgzdrkfO0kZ\nnW8Qn3Kux+JYwLTcffH4b2HsazrsTBJdINrKdy7jdIAOR2A9tYG/bVlPPbvc\nYIiQ+m/zuvULv44U71tCJGQ3rSlia+e4vANIR//5HAZERqfgZASU+ebnmSCW\nHNfV/UvlHrOgxS2EsmAhho8f994xua2dOBLeCezSy+StdtkVNgENP4Nc8DlE\n5MVISVViKTZEyfs2vEpKi0rHeK+AiurM5B3P5atnCMIfdT2udeLZKcMkRC8W\n/TOG\r\n=7C+y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDUYhWgn3+8kMHw0oRpdSBe/whq+wZ1RhNcwgkeYu81KwIgJKWdjkviPw+l+lxNxZnTEZVC2DiFz1LAdsgI6SZpFmo="}],"size":4239,"noattachment":false,"key":"/@xstate/react/-/@xstate/react-0.4.0.tgz"},"maintainers":[{"name":"davidkpiano","email":"davidkpiano@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react_0.4.0_1558046666913_0.23779616557237215"},"_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":1558046667027,"_cnpm_publish_time":1558046667027,"dist-tags":{"alpha":"7.0.0-alpha.7","beta":"7.0.0-beta.0","latest":"6.1.0"}}