{"name":"react-promise-suspense","version":"0.2.0","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":{"deep-equal":"^1.0.1"},"gitHead":"1ecac7a401d6e2e40e7f2561a83e57299353dc43","_id":"react-promise-suspense@0.2.0","_nodeVersion":"11.11.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-IO4LGdpabsYkq/iWyY1qxdTFTAc7apgOcaUGp67RFhyq/g6rn1hxULV6gInsKDyCVKrm7oh/AOwJe1Vc70GMvw==","shasum":"7ed2424b901a71c6b3ba8b748908ec2d40c8e9f4","tarball":"http://registry-npm.ywwl.com/react-promise-suspense/download/react-promise-suspense-0.2.0.tgz","fileCount":14,"unpackedSize":449642,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJchkW7CRA9TVsSAnZWagAAVzcP/2tSAFbtY9TPN1IRx8sC\n7uTdNqUOJzF5O/qm/UEWweX2tnyb4Jdwu3N5tTlYyfqXzqvdREhZRq0oJh1e\njgFGsKuDP/txBRaYaAQIPmkRWL7vA5w094hgkPZz0ticoTkLKACkTg7AGc8F\n+3C7kms8AEC5KMR/RJG9CRFmGK9Pee3G4ehaUZTHmp4J4TMdnIsHLyfAszU2\nUVdMSILVdalrshfxr6Dg2XZrwd+zj7rnAS//vlnO+DmtIeUYWGR5P6W5nrbk\ngYEpiYsQOL+X2zLM8RsQ2cF4QuOmzLSHD1tPZq1l00Vsa7Y5ECkroJ7/49iI\nfzNmU3QeRMk7ZsRRSa4PPxrra84fEdncYpZ26SxhcFXiYBRyzBTq3JY3vQqQ\nRxVQPpvh1q101UAOcqHBKzTzQL1mpcJY0xvsG6Lg22+VS8cOzeA5Ae3DukCq\nSUiLZx1araUvrvYJgshhSc6RK9dMBn7U5GGUXVWHqREWZPkCnwfwHMeJYAhe\np8C+vlf6taHaBQ8CeV6sHINw0wv0eG4MdVWUtB7AoO2OTUQjFY4Xp9HoAsWl\nTYpvcnM1Bsu9R5HqMdC6aQRd31jTyKd2KutXxZdk5shqM4uLWN0y3MOkzW7I\nRScokSZ6hX4J2Pq/BkrndXdOMau9ZIMmtjmS6NJgIC7YCpU4oYUvynrHUzAS\nocsU\r\n=alhx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCppaq5HCS7ONkwN2P8Ac8HhFw9zBKQUBTjwisuflpWDQIhAIYxHrsW7hHUCilqOq6Y9skMSzEgozfXTkZ2+hK44iWL"}],"size":170895,"noattachment":false,"key":"/react-promise-suspense/-/react-promise-suspense-0.2.0.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.2.0_1552303546160_0.5073617675670783"},"_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":1552303546343,"_cnpm_publish_time":1552303546343,"dist-tags":{"latest":"0.3.4"}}