├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── example ├── .gitignore ├── .yalc │ └── react-promise-suspense │ │ ├── .vscode │ │ └── settings.json │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ └── yalc.sig ├── README.md ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt ├── src │ ├── App.css │ ├── App.test.tsx │ ├── App.tsx │ ├── index.css │ ├── index.tsx │ ├── logo.svg │ ├── react-app-env.d.ts │ ├── reportWebVitals.ts │ └── setupTests.ts ├── tsconfig.json └── yalc.lock ├── lib └── index.ts ├── package-lock.json ├── package.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | build -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /.gitignore 3 | /.npmignore 4 | /.travis.yml 5 | /tsconfig.json 6 | /lib/index.ts 7 | /example -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Vignesh M 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # usePromise 2 | 3 | React hook for resolving promises with Suspense support. 4 | 5 | Inspired by [fetch-suspense](https://github.com/CharlesStover/fetch-suspense), but this one is not limited to fetch, `usePromise` works with any Promise. 6 | 7 | [![version](https://img.shields.io/npm/v/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense) 8 | [![minified size](https://img.shields.io/bundlephobia/min/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense) 9 | [![minzipped size](https://img.shields.io/bundlephobia/minzip/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense) 10 | [![downloads](https://img.shields.io/npm/dt/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense) 11 | 12 | ## Install 13 | 14 | * `npm install react-promise-suspense --save` 15 | 16 | ## Example 17 | 18 | - Here's an [Codesandbox example](https://codesandbox.io/s/react-promise-suspense-example-t14mh) of a setTimeout delayed component. 19 | 20 | - Awaiting a fetch promise: 21 | ```js 22 | import usePromise from 'react-promise-suspense'; 23 | 24 | const fetchJson = input => fetch(input).then(res => res.json()); 25 | 26 | const MyFetchingComponent = () => { 27 | // usePromise(Promise, [inputs,],) 28 | const data = usePromise(fetchJson, [ 29 | 'https://pokeapi.co/api/v2/pokemon/ditto/', 30 | { method: 'GET' }, 31 | ]); 32 | 33 | return
{JSON.stringify(data, null, 2)}
; 34 | }; 35 | 36 | const App = () => { 37 | return ( 38 | 39 | 40 | 41 | ); 42 | }; 43 | ``` 44 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /example/.yalc/react-promise-suspense/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib" 3 | } 4 | -------------------------------------------------------------------------------- /example/.yalc/react-promise-suspense/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Vignesh M 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /example/.yalc/react-promise-suspense/README.md: -------------------------------------------------------------------------------- 1 | # usePromise 2 | 3 | React hook for resolving promises with Suspense support. 4 | 5 | Inspired by [fetch-suspense](https://github.com/CharlesStover/fetch-suspense), but this one is not limited to fetch, `usePromise` works with any Promise. 6 | 7 | [![version](https://img.shields.io/npm/v/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense) 8 | [![minified size](https://img.shields.io/bundlephobia/min/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense) 9 | [![minzipped size](https://img.shields.io/bundlephobia/minzip/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense) 10 | [![downloads](https://img.shields.io/npm/dt/react-promise-suspense.svg)](https://www.npmjs.com/package/react-promise-suspense) 11 | 12 | ## Install 13 | 14 | * `npm install react-promise-suspense --save` 15 | 16 | ## Example 17 | 18 | - Here's an [Codesandbox example](https://codesandbox.io/s/react-promise-suspense-example-t14mh) of a setTimeout delayed component. 19 | 20 | - Awaiting a fetch promise: 21 | ```js 22 | import usePromise from 'react-promise-suspense'; 23 | 24 | const fetchJson = input => fetch(input).then(res => res.json()); 25 | 26 | const MyFetchingComponent = () => { 27 | // usePromise(Promise, [inputs,],) 28 | const data = usePromise(fetchJson, [ 29 | 'https://pokeapi.co/api/v2/pokemon/ditto/', 30 | { method: 'GET' }, 31 | ]); 32 | 33 | return
{JSON.stringify(data, null, 2)}
; 34 | }; 35 | 36 | const App = () => { 37 | return ( 38 | 39 | 40 | 41 | ); 42 | }; 43 | ``` 44 | -------------------------------------------------------------------------------- /example/.yalc/react-promise-suspense/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-promise-suspense", 3 | "version": "0.3.3", 4 | "description": "React hook for resolving promises with Suspense support", 5 | "main": "build/index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/vigzmv/react-promise-suspense.git" 9 | }, 10 | "keywords": [ 11 | "react", 12 | "fetch", 13 | "suspense", 14 | "promise", 15 | "hooks" 16 | ], 17 | "author": "Vignesh M 0.2%", 35 | "not dead", 36 | "not op_mini all" 37 | ], 38 | "development": [ 39 | "last 1 chrome version", 40 | "last 1 firefox version", 41 | "last 1 safari version" 42 | ] 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /example/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vigzmv/react-promise-suspense/05365a70f4fa947b38d3743d2f58de5daf956291/example/public/favicon.ico -------------------------------------------------------------------------------- /example/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /example/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vigzmv/react-promise-suspense/05365a70f4fa947b38d3743d2f58de5daf956291/example/public/logo192.png -------------------------------------------------------------------------------- /example/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vigzmv/react-promise-suspense/05365a70f4fa947b38d3743d2f58de5daf956291/example/public/logo512.png -------------------------------------------------------------------------------- /example/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /example/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /example/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/src/App.test.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render, screen } from '@testing-library/react'; 3 | import App from './App'; 4 | 5 | test('renders learn react link', () => { 6 | render(); 7 | const linkElement = screen.getByText(/learn react/i); 8 | expect(linkElement).toBeInTheDocument(); 9 | }); 10 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import React, { Suspense } from "react"; 2 | import usePromise from "react-promise-suspense"; 3 | 4 | const fetchJson = (input: RequestInfo | URL) => 5 | fetch(input).then((res) => res.json()); 6 | 7 | const MyFetchingComponent = () => { 8 | const data = usePromise<[string, { method: string }], Record>( 9 | fetchJson, 10 | ["https://pokeapi.co/api/v2/pokemon/ditto/", { method: "GET" }] 11 | ); 12 | 13 | return
{JSON.stringify(data, null, 2)}
; 14 | }; 15 | 16 | const App = () => { 17 | return ( 18 | 19 | 20 | 21 | ); 22 | }; 23 | 24 | export default App; 25 | -------------------------------------------------------------------------------- /example/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /example/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import './index.css'; 4 | import App from './App'; 5 | import reportWebVitals from './reportWebVitals'; 6 | 7 | const root = ReactDOM.createRoot( 8 | document.getElementById('root') as HTMLElement 9 | ); 10 | root.render( 11 | 12 | 13 | 14 | ); 15 | 16 | // If you want to start measuring performance in your app, pass a function 17 | // to log results (for example: reportWebVitals(console.log)) 18 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 19 | reportWebVitals(); 20 | -------------------------------------------------------------------------------- /example/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /example/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /example/src/reportWebVitals.ts: -------------------------------------------------------------------------------- 1 | import { ReportHandler } from 'web-vitals'; 2 | 3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => { 4 | if (onPerfEntry && onPerfEntry instanceof Function) { 5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { 6 | getCLS(onPerfEntry); 7 | getFID(onPerfEntry); 8 | getFCP(onPerfEntry); 9 | getLCP(onPerfEntry); 10 | getTTFB(onPerfEntry); 11 | }); 12 | } 13 | }; 14 | 15 | export default reportWebVitals; 16 | -------------------------------------------------------------------------------- /example/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /example/yalc.lock: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v1", 3 | "packages": { 4 | "react-promise-suspense": { 5 | "signature": "34e72f37b902a1476478d24797c8c523", 6 | "file": true 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /lib/index.ts: -------------------------------------------------------------------------------- 1 | const deepEqual = require("fast-deep-equal"); 2 | 3 | interface PromiseCache { 4 | promise: Promise; 5 | inputs: Array; 6 | error?: any; 7 | response?: any; 8 | } 9 | 10 | const promiseCaches: PromiseCache[] = []; 11 | 12 | const usePromise = ( 13 | promise: (...inputs: Args) => Promise, 14 | inputs: Args, 15 | lifespan: number = 0 16 | ): Result => { 17 | // Cache Check 18 | for (const promiseCache of promiseCaches) { 19 | if (deepEqual(inputs, promiseCache.inputs)) { 20 | // If an error occurred, 21 | if (Object.prototype.hasOwnProperty.call(promiseCache, "error")) { 22 | throw promiseCache.error; 23 | } 24 | 25 | // If a response was successful, 26 | else if (Object.prototype.hasOwnProperty.call(promiseCache, "response")) { 27 | return promiseCache.response; 28 | } 29 | throw promiseCache.promise; 30 | } 31 | } 32 | 33 | // The request is new or has changed. 34 | const promiseCache: PromiseCache = { 35 | promise: 36 | // Make the promise request. 37 | promise(...inputs) 38 | .then((response: Result) => { 39 | promiseCache.response = response; 40 | }) 41 | .catch((e: Error) => { 42 | promiseCache.error = e; 43 | }) 44 | .then(() => { 45 | if (lifespan > 0) { 46 | setTimeout(() => { 47 | const index = promiseCaches.indexOf(promiseCache); 48 | if (index !== -1) { 49 | promiseCaches.splice(index, 1); 50 | } 51 | }, lifespan); 52 | } 53 | }), 54 | inputs, 55 | }; 56 | 57 | promiseCaches.push(promiseCache); 58 | throw promiseCache.promise; 59 | }; 60 | 61 | export = usePromise; 62 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-promise-suspense", 3 | "version": "0.3.4", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "react-promise-suspense", 9 | "version": "0.3.4", 10 | "license": "MIT", 11 | "dependencies": { 12 | "fast-deep-equal": "^2.0.1" 13 | }, 14 | "devDependencies": { 15 | "@types/node": "^18.13.0", 16 | "typescript": "^4.9.5" 17 | } 18 | }, 19 | "node_modules/@types/node": { 20 | "version": "18.13.0", 21 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz", 22 | "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==", 23 | "dev": true 24 | }, 25 | "node_modules/fast-deep-equal": { 26 | "version": "2.0.1", 27 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", 28 | "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" 29 | }, 30 | "node_modules/typescript": { 31 | "version": "4.9.5", 32 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", 33 | "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", 34 | "dev": true, 35 | "bin": { 36 | "tsc": "bin/tsc", 37 | "tsserver": "bin/tsserver" 38 | }, 39 | "engines": { 40 | "node": ">=4.2.0" 41 | } 42 | } 43 | }, 44 | "dependencies": { 45 | "@types/node": { 46 | "version": "18.13.0", 47 | "resolved": "https://registry.npmjs.org/@types/node/-/node-18.13.0.tgz", 48 | "integrity": "sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==", 49 | "dev": true 50 | }, 51 | "fast-deep-equal": { 52 | "version": "2.0.1", 53 | "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", 54 | "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" 55 | }, 56 | "typescript": { 57 | "version": "4.9.5", 58 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", 59 | "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", 60 | "dev": true 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-promise-suspense", 3 | "version": "0.3.4", 4 | "description": "React hook for resolving promises with Suspense support", 5 | "main": "build/index.js", 6 | "repository": { 7 | "type": "git", 8 | "url": "git+https://github.com/vigzmv/react-promise-suspense.git" 9 | }, 10 | "keywords": [ 11 | "react", 12 | "fetch", 13 | "suspense", 14 | "promise", 15 | "hooks" 16 | ], 17 | "author": "Vignesh M