{"name":"react-promise-suspense","version":"0.3.1","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":"fac289471aff462a22f007898cb276d5dcb1936a","_id":"react-promise-suspense@0.3.1","_nodeVersion":"12.7.0","_npmVersion":"6.10.0","dist":{"integrity":"sha512-3EE8QdWReri6kfwNQZW/y24x1jm2oaOGhy+/7A9z7eVMfPAofZJCqx7BuGLr7jok/NxclGL98AhLY6aHcDSTkA==","shasum":"b4eb428c36efb27f0a3df265de4647acdb27aa1a","tarball":"http://registry-npm.ywwl.com/react-promise-suspense/download/react-promise-suspense-0.3.1.tgz","fileCount":15,"unpackedSize":1116045,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdQ1c+CRA9TVsSAnZWagAAydQP/3OcjCwDd/WRBDoEuUk5\nHC+PzO/aIutd/TvoCKhXZBdhP+RlrVUQRuq8CjTSWlttpb40eCuKWwgt8Fqk\nWGS0MUCVMPsQ0umcZrsMdxy+kHwG3MNkQjMOTU9ayh7kn3CHKu0aKqw91JeL\naKiUaCuKLsWsvReGR6Pz5jlYHRFqmtXbL/krMjtKVvw1cAFGEB24HkENa3Fw\no6A0kEutPLsTyS3LAK4yy2S7tTTCSwqKAuoCpJ9OZvAUYJ98bmRztWfgd9MY\nrCv7pjrDX3OKTnko3lQWJpK/cC0LwYe+uGYGMRxT/Ro48WBeMyY7oI1dWeHA\nbCtPt2xuErvu+p3f/KzO7dSw0+mQJXkwTfI6rVmv+xJtQ//z421A2oXMgeiw\nla1roO54jevP6S1uYUeNjwZl4A5WbrvUpkCXWa69ATP8B+OXuooMEuAO8Ijf\nzawn3CTBt6ZfCjCdj8nfZvGcsYXMgiWhmhbqB0TVhDsvmj4diY4/y4zxq0eL\n2L1XOdF4wKfy1R5/SsTVaBoWzljwqNhrZdLDZBvpAPVu+qvvQlVwlZ31omKL\nCF9PmvAg7n5edI2tCw2VrnrxqKauhC/LjXCTdkUDL2I579ZGZxAoUXpA7Nds\nJgH5Y/LndyOW4bkzcv2hNRR3+/fGQBGrf47z5V5mU4DPcff+hVniYvV9w8yY\nyoM7\r\n=i8ik\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGw8wDYX7WV1pZNS/fZ5rhPiSc4r3jTossLNiV77aVMiAiEAgcGASz5cW/dQF0BaMZxTffDXRqQJT4fu2SXFrQ6nf/M="}],"size":311775,"noattachment":false,"key":"/react-promise-suspense/-/react-promise-suspense-0.3.1.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.1_1564694333903_0.6713214814216526"},"_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":1564694334025,"_cnpm_publish_time":1564694334025,"dist-tags":{"latest":"0.3.4"}}