{"_id":"@auroratide/use-async","_rev":"1-0aeb27b2ea70bf92f088426cf6ad57a1","name":"@auroratide/use-async","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@auroratide/use-async","version":"0.1.0","description":"Simple React hook for handling asynchronous operations","keywords":["react","hook","async","asynchronous","promises"],"main":"index.js","scripts":{"test":"jest examples","prepublishOnly":"npm run test"},"author":{"name":"Timothy Foster","url":"https://auroratide.com"},"repository":{"type":"git","url":"git+https://github.com/Auroratide/use-async.git"},"license":"ISC","devDependencies":{"@babel/plugin-transform-runtime":"^7.4.4","@babel/preset-env":"^7.4.5","@babel/preset-react":"^7.0.0","@babel/runtime":"^7.4.5","@testing-library/react":"^8.0.1","babel-jest":"^24.8.0","jest":"^24.8.0","react":"^v16.9.0-alpha.0","react-dom":"^v16.9.0-alpha.0"},"peerDependencies":{"react":">=16.8"},"gitHead":"790f30c68ac2315c018a023cae0de3e4a0be9d34","bugs":{"url":"https://github.com/Auroratide/use-async/issues"},"homepage":"https://github.com/Auroratide/use-async#readme","_id":"@auroratide/use-async@0.1.0","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","dist":{"integrity":"sha512-Ky9GV4P5Ivgz/cUSqzZVSIJS16cVhx474WwAkx+RCiWPCCmHocX2sSw3ia1wQu9llOPMc8P8Wo+xQeufHgrPPg==","shasum":"4570e99db05635019f320b02793a9d5eb747a53a","tarball":"https://registry.npmjs.org/@auroratide/use-async/-/use-async-0.1.0.tgz","fileCount":4,"unpackedSize":3325,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdAk0JCRA9TVsSAnZWagAAHasP/1EAUAHyz8OzzH7RmtKX\n546cAyWZZDSvIZcU8F2wdIL0ql69Cn0qqJn0HnHeHq+b6GyHw1hQuMxjjehx\nueaMpFpzNTvDu6RyDYUbYupQpR/JY7kSPKc/2sUkKM/M9PIZjEGamFGIQdKK\ncA/2+DxiLjPG6BQS382ErdSGI47vye1u+YSOROqmkXVgUvS+XczfHI4ke7Wu\nPXIYchOLyEy+LLmWU2PyGBzBseksY9+82UyDGxpxPvtMh2Y6zGHbMzqw6nc5\nJo+YmK0xZxzmYvqKbeXI2/Nh9Xp+qsSG5Akc95LrTUcNQlbhX0/npbbmYTo3\ntUshiO5BxN8CiIDMlwnKcPwAJDurrwcx/L3qNiBHt1O8uwXqoMMdYgnVmwT6\n3DVt7m+ZzoRzTexkgEmx95fQ+80OMs5/wpsEy5CvjUnUtdjlU1F5UNpJ0M0W\nbE24DsEHhT3rAAFjKUd2gN3ALRBlvZna3lpRtHqqet1WYtpaGT87G23XTgu6\nUi/uO1olLs7DK+ZexVqHLsPy9cTQ9hgQGRQo7umBI1kJTA9uIM/Ca1Ubhcl2\n+sI3O6ogE0FeLo6mmS1oIV8JAp/Sp6x7eqYCzyTT1UFRbpbv/lqg+ykmMIRV\nHJlwA/achAEAOao/QWhw83i8NoAe9L8Lvew4pWlQFitIPgvNUuW/ex7kRAXV\nya4T\r\n=QiWd\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICWzJPT+0wX/nX3f27Wv3IcmObf9m6f+FgwMOk7bDYeBAiEApXSUeg0PTpw1s/N6M+oQXpAOCLCrpwCkceBjk5+2318="}]},"maintainers":[{"name":"auroratide","email":"tf.auroratide@gmail.com"}],"_npmUser":{"name":"auroratide","email":"tf.auroratide@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/use-async_0.1.0_1560431881419_0.19242753467456364"},"_hasShrinkwrap":false}},"time":{"created":"2019-06-13T13:18:01.391Z","0.1.0":"2019-06-13T13:18:01.544Z","modified":"2022-04-04T16:29:02.647Z"},"maintainers":[{"name":"auroratide","email":"tf.auroratide@gmail.com"}],"description":"Simple React hook for handling asynchronous operations","homepage":"https://github.com/Auroratide/use-async#readme","keywords":["react","hook","async","asynchronous","promises"],"repository":{"type":"git","url":"git+https://github.com/Auroratide/use-async.git"},"author":{"name":"Timothy Foster","url":"https://auroratide.com"},"bugs":{"url":"https://github.com/Auroratide/use-async/issues"},"license":"ISC","readme":"# use-async\n\n**use-async** is just another React hook for handling asynchronous operations in a stateful way! It automatically juggles three potential states an operation can be in (_waiting, done, and error_), providing these as variables which your component can conditionally render upon.\n\n```jsx\nimport useAsync from '@auroratide/use-async';\nimport api from './api';\n\nconst PostListPage = () => {\n  const { result, waiting, error, call } = useAsync(api.get);\n\n  return <>\n    <button onClick={call}>Get Data</button>\n    {waiting && <Loading />}\n    {error && <ErrorPage error={error} />}\n    {result && <PostList posts={result} />}\n  </>;\n}\n```\n\n## How to use\n\nTo see how to use this library, check out the `examples` folder for sample usages! The goal is to _actually_ use tests as documentation by reframing the paradigm into thinking of our tests as \"example usages\". This means you can learn how to use the library directly from the code, and this means less written documentation that's prone to becoming out-of-date.\n","readmeFilename":"README.md"}