{"name":"react-promise-suspense","version":"0.3.4","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":"^18.13.0","typescript":"^4.9.5"},"dependencies":{"fast-deep-equal":"^2.0.1"},"types":"./build/index.d.ts","gitHead":"05365a70f4fa947b38d3743d2f58de5daf956291","_id":"react-promise-suspense@0.3.4","_nodeVersion":"16.13.0","_npmVersion":"8.19.2","dist":{"integrity":"sha512-I42jl7L3Ze6kZaq+7zXWSunBa3b1on5yfvUW6Eo/3fFOj6dZ5Bqmcd264nJbTK/gn1HjjILAjSwnZbV4RpSaNQ==","shasum":"05d19a75703d71374674840056cfef2fcd38809d","tarball":"http://registry-npm.ywwl.com/react-promise-suspense/download/react-promise-suspense-0.3.4.tgz","fileCount":5,"unpackedSize":6852,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFrH0nQijaujvau2if20kLy7Cmf+D/eec0xYpIwwQH5rAiAvlG/s3oRu47z7S3YTVzjUDNgcLk6tE717ERcNsNYzeA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj6JRCACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmry3g/9F6/H6qftuRYZC+kbh2I0hgGNExJXVAuYIeZ0pmAPirOBdVcM\r\niwxm86YK3Sv3HwefEiCQ6a7/KL00d/svrHEOkinVx/0R1Xjo/ErLx4vyhL54\r\n5bBl4u71M5KAuBYQYbLNM+80w3CEeAHJ72TMpy6rF6yiPEjCZdTy3Ac1JHqE\r\nlRGN0S/rhL8fpP8dkyBqr4MSdRPB43aI2jIAWpuNOVRQtwHn5FfAnKyfQ1GS\r\nZ3qIoojBr6FW8/yhmZ8wuFvHq7PkYCJyrCNEbP5jC/Ezat/cMaWUXKHeUH2G\r\nfI7G5Xys4hKh4HxKXG3MzVs+L3t3Ep4az4dPP7TWGkG14hjmGCH58lkC5egG\r\nLHnlvYQoGprJtXhOiHedH5G7clXlGoi7nhypo5IlzF+pSTBIPCTHRmEqUEl1\r\nA5vIV/n0A1VMBfFdAe8j/0L+PBgZdz7B0FQjs0KUogi8yFAEToGLOA9lXKOF\r\nUPm7Sym7pxP3wLSo2VMhPo8J8egpcnGiSVI9dw/Lr1XU+uX0fy8XDxSjzliZ\r\nQ0WvCHD1C03ZQyPS2SknMHXAHb295n3RqcC44PZEoK+QNt13aVy7p2h2zlGy\r\nynQ8OJeYB3TziJKlWfIVVG9ifEcAyuMaI3HPsVs/8X2Cc0pN0BWHVwnya4H+\r\nUeY9kfLSAIjybVhaJKntMc8miCOXNMfTJvw=\r\n=ZlCF\r\n-----END PGP SIGNATURE-----\r\n","size":2867,"noattachment":false,"key":"/react-promise-suspense/-/react-promise-suspense-0.3.4.tgz"},"_npmUser":{"name":"vigzmv","email":"vigzmv@outlook.com"},"directories":{},"maintainers":[{"name":"vigzmv","email":"vigzmv@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-promise-suspense_0.3.4_1676186690063_0.0920316701578845"},"_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":1676186690218,"_cnpm_publish_time":1676186690218,"dist-tags":{"latest":"0.3.4"}}