{"name":"react-promise-suspense","version":"0.3.3","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":"26c62f558daa169e4ace4e9bcdddfc1f240605b2","_id":"react-promise-suspense@0.3.3","_nodeVersion":"13.13.0","_npmVersion":"6.14.4","dist":{"integrity":"sha512-OdehKsCEWYoV6pMcwxbvJH99UrbXylmXJ1QpEL9OfHaUBzcAihyfSJV8jFq325M/wW9iKc/BoiLROXxMul+MxA==","shasum":"b085c7e0ac22b85fd3d605b1c4f181cda4310bc9","tarball":"http://registry-npm.ywwl.com/react-promise-suspense/download/react-promise-suspense-0.3.3.tgz","fileCount":5,"unpackedSize":6445,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJerr/JCRA9TVsSAnZWagAAL08P/j8tqlRpLE5IRqwHm19g\nIiAoDwEOX8s2WQXvGUyiE8cj6dd1Ynj3YjSjrApN56E7IiEOds79PWpRLTW1\nyPP286V5rB3loSWBJ2Ceye7NI+sx2mMjTLnzKY0x12TSWKAa5kPg5bwvmRO3\neK7Z/YIrVeCPPGY+MhrgpQaa8/eX9LrhgZt586Z9olFxsXna95mrKDF9iLzk\nEXzfBu6zA+w/5MqenvX0T/n5bu7Pr/NPIcaqjuNBQrsrT6Zmkamp4w9w0r2r\ny8BmLZVargBXAdXYDS3RC6DrjPcuyuU5vtPxPBNS3jO5DMm7NcDWlqhKhOgF\nVdm+kwsEG5zJNdWfCE2z8ZgERAhliN0U25zhfBhV20lboXzu6IT89hNfvcl4\nlL7IKhU0UzDRoBiaLLJYUV4EYEV2futxHJ87/hw+xcpL+BozKsj408fW7QqN\nsElA3b+ahYgyqijUroQuym0yNEh5st9lgIq6MQ261/5CxcmSgDzOc0e98/02\nAb7xHtwAMTtxXxIURVBGkly1etaAWcTwxvtyefMtg/fVu4ohHuzuXccyIkqA\nKDGcnTS8om1lm9LNaHmr1/kOruGCVcDXs56dYrielgSi4rtNqJmcAd7L4Mlv\n2Sgt1/41R5XZYGj478FHgLlB0bO7uwoew6XKHOyLEnvEwKYbcDy1VKIFDb3z\ndKRh\r\n=Dp0G\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC/KR1o0dH8dLg1Nriv0yP98Z908mu5un94aZ6Qgp092wIhAOgqTLlb02Xgp7BTkwPrTCpSWSkCSQzWVflKU4qJvVeu"}],"size":2708,"noattachment":false,"key":"/react-promise-suspense/-/react-promise-suspense-0.3.3.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.3_1588510665355_0.5225698071267666"},"_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":1588510665475,"_cnpm_publish_time":1588510665475,"dist-tags":{"latest":"0.3.4"}}