Gathering detailed insights and metrics for @phytonmk/react-promise-suspense
Gathering detailed insights and metrics for @phytonmk/react-promise-suspense
Gathering detailed insights and metrics for @phytonmk/react-promise-suspense
Gathering detailed insights and metrics for @phytonmk/react-promise-suspense
A React hook for resolving promises with Suspense support. <1kb bundle.
npm install @phytonmk/react-promise-suspense
Typescript
Module System
Node Version
NPM Version
TypeScript (57.49%)
HTML (27.27%)
CSS (14.73%)
Standard ML (0.51%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
165 Stars
27 Commits
9 Forks
2 Watchers
1 Branches
2 Contributors
Updated on Apr 26, 2025
Latest Version
0.0.2
Package Id
@phytonmk/react-promise-suspense@0.0.2
Unpacked Size
13.58 kB
Size
4.99 kB
File Count
8
NPM Version
8.3.0
Node Version
17.3.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
This is is fork of react-promise-suspense package with bug fixes, tests and minor but valuable features. It's going to replace original package as soon as possible.
React hook for resolving promises with Suspense support.
Fork of vigzmv's react-promise-suspense that is not longer under development.
Inspired by fetch-suspense, but this one is not limited to fetch, usePromise
works with any Promise.
1yarn add @phytonmk/react-promise-suspense
2# or using npm
3npm install @phytonmk/react-promise-suspense --save
Awaiting a fetch promise:
1import usePromise from 'react-promise-suspense'; 2 3const fetchJson = async (url, params) => { 4 const response = await fetch(input); 5 6 return await response.json(); 7}; 8 9const MyFetchingComponent = () => { 10 const data = usePromise(fetchJson, [ 11 'https://pokeapi.co/api/v2/pokemon/ditto/', 12 { method: 'GET' }, 13 ]); 14 15 return <pre>{JSON.stringify(data, null, 2)}</pre>; 16}; 17 18const App = () => { 19 return ( 20 <React.Suspense fallback="Loading..."> 21 <MyFetchingComponent /> 22 </React.Suspense> 23 ); 24};
react-promise-suspense
In most cases you don't need to do anything to migrate from react-promise-suspense
to @phytonmk/react-promise-suspense
(expect, surely imported package name replacement).
The only thing that changed in api without backward capability is that first argument of usePromise
must persist between renders.
If first argument of usePromise
is different (by reference) each of them will be called in infinite loop.
Migrations examples:
1const MyFetchingComponent = () => { 2- const fetchData = () => {...}; 3+ const fetchData = React.useCallback(() => {...}, []); 4 const date = usePromise(fetchData, ) 5}
1+ const fetchData = () => {...}; 2const MyFetchingComponent = () => { 3- const fetchData = () => {...}; 4 const date = usePromise(fetchData, ) 5}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 2/22 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
36 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More