{"name":"react-promise-suspense","version":"0.3.2","description":"React hook for resolving promises with Suspense support","main":"build/index.js","repository":{"type":"git","url":"git+https://github.com/vigzmv/react-promise-suspense.git"},"keywords":["react","fetch","suspense","promise","hooks"],"author":{"name":"Vignesh M"},"license":"MIT","bugs":{"url":"https://github.com/vigzmv/react-promise-suspense/issues"},"homepage":"https://github.com/vigzmv/react-promise-suspense#readme","scripts":{"build":"tsc --outDir build","dev":"tsc --outDir build --watch","prepublishOnly":"npm run build","test":"exit 0"},"devDependencies":{"@types/node":"^10.12.1","typescript":"^3.1.5"},"dependencies":{"fast-deep-equal":"^2.0.1"},"gitHead":"88a0be4eaf32ac9236ce8afd97aed23492985633","_id":"react-promise-suspense@0.3.2","_nodeVersion":"12.13.1","_npmVersion":"6.12.1","dist":{"integrity":"sha512-1HAhT6eCSaeAp/u1mDsWgWQQDX/IhNjYAl4novVXq4DhH+AQPYEdagZM8M5SXI5qgbmmbcTZOqioH7MpsBmr8Q==","shasum":"202555b449cfb918f985aa93596029d842c4dcb4","tarball":"http://registry-npm.ywwl.com/react-promise-suspense/download/react-promise-suspense-0.3.2.tgz","fileCount":15,"unpackedSize":1144831,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd7pblCRA9TVsSAnZWagAAIqEP/1o6m+s1Oq+XqljKvwio\nd99wx7+EOvjc1bI2WdwOe+CrNjaTic0FqH1MoQ7wiJyECcJ1oSRuO89meEA9\nEVsovmPbUBVGm1tuej2DQAGgfYStsQjoGR9ZApY0emsEwCO/0goiHfsi7ID/\n3Ab2Qag0dv3BRgMWTN6h2dSMxTpP+9c7XEWO3CB1ymbpHKZifgkle48zo8OO\nqNuEcrj1NzYVUFabvMJy1IzCjNQ2qdZSu++BM7mpjgOMBE+UQOmLZnFYaZqX\nvHCrRDWs1jLxf7ZgYGpves0+FzCwxoCUJenYhwd7PaCGswXVXDwuaEhpIw2Z\nfx9wMMcj5d8eQ+uySAI9NNj9l2TLSYFKsEYwYXhbqwpWhlswMrT1yAOQuptA\nkxQ6xmrvDuWHBNlMmbqmNB+mTdBon4Axf9K4DqeDDNxtYIXqzyaPw6sAg59n\n/bDHSdDbAJO2mTnEfDTCE+vJniO1bPKrTSQPw2Eul5u5jFnDMhFlm4pMpdJ1\nNa009PZLT0OIZBbqEkeJK/ikqPYcEPuSFv7rM9rd+qcHzEgmaR8UpGYhxbcJ\nO9drMoN6scZqrUYyBRhJuHRuMBV/nQdyZ0NurkCURxhbJSwfZEAPwTqICVJB\nXCq+rlbZpuRPHzQyoIFHYayYNCt9cmMvlhbdbbjXv6zTz7XVosv+VErLwX/k\n58HJ\r\n=2Vzi\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHh+hAkU8X28C0vizPo+Di+3xMhr/7T/chtmzzWevMTbAiEAgc4w5HUT8im34Yi1PXh/R0rZ3Z0o+Uq1Qn5qamSwhmw="}],"size":313152,"noattachment":false,"key":"/react-promise-suspense/-/react-promise-suspense-0.3.2.tgz"},"maintainers":[{"name":"vigzmv","email":"vigzmv@outlook.com"}],"_npmUser":{"name":"vigzmv","email":"vigzmv@outlook.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-promise-suspense_0.3.2_1575917285085_0.04893297865803525"},"_hasShrinkwrap":false,"readme":"# usePromise\n\nReact hook for resolving promises with Suspense support.\n\nInspired by [fetch-suspense](https://github.com/CharlesStover/fetch-suspense), but this one is not limited to fetch, `usePromise` works with any Promise.\n\n[![version](https://img.shields.io/npm/v/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense)\n[![minified size](https://img.shields.io/bundlephobia/min/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense)\n[![minzipped size](https://img.shields.io/bundlephobia/minzip/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense)\n[![downloads](https://img.shields.io/npm/dt/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense)\n\n## Install\n\n* `npm install react-promise-suspense --save`\n\n## Example\n\n- Here's an [Codesandbox example](https://codesandbox.io/s/react-promise-suspense-example-t14mh) of a setTimeout delayed component. \n\n- Awaiting a fetch promise:\n```js\nimport usePromise from 'react-promise-suspense';\n\nconst fetchJson = input => fetch(input).then(res => res.json());\n\nconst MyFetchingComponent = () => {\n  // usePromise(Promise, [inputs,],)\n  const data = usePromise(fetchJson, [\n    'https://pokeapi.co/api/v2/pokemon/ditto/',\n    { method: 'GET' },\n  ]);\n\n  return <pre>{JSON.stringify(data, null, 2)}</pre>;\n};\n\nconst App = () => {\n  return (\n    <Suspense fallback=\"Loading...\">\n      <MyFetchingComponent />\n    </Suspense>\n  );\n};\n```\n","publish_time":1575917285295,"_cnpm_publish_time":1575917285295,"dist-tags":{"latest":"0.3.4"}}