Gathering detailed insights and metrics for use-async-resource-with-recoil
Gathering detailed insights and metrics for use-async-resource-with-recoil
Gathering detailed insights and metrics for use-async-resource-with-recoil
Gathering detailed insights and metrics for use-async-resource-with-recoil
A React custom hook to work with React Suspense and Recoil js
npm install use-async-resource-with-recoil
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
2,256
Last Day
1
Last Week
8
Last Month
24
Last Year
169
3 Stars
15 Commits
5 Branches
1 Contributors
Updated on Sep 27, 2021
Latest Version
1.0.4
Package Id
use-async-resource-with-recoil@1.0.4
Unpacked Size
5.63 kB
Size
2.59 kB
File Count
5
NPM Version
6.14.6
Node Version
12.18.3
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
60%
8
Compared to previous week
Last Month
14.3%
24
Compared to previous month
Last Year
6.3%
169
Compared to previous year
npm i use-async-resource-with-recoil
1 .... 2 import useAsyncResourceWithRecoil from "use-async-resource-with-recoil"; 3 import React, {Suspense} from "react" 4 5 //inside the component 6 ... 7 const callOnlyOnFetchAgain = false 8 const { 9 dataReader, 10 data, 11 fetchAgain, 12 dataSetter 13 } = useAsyncResourceWithRecoil( 14 apiFunction, 15 argumentsOfapiFunction, 16 recoilAtom, 17 callOnlyOnFetchAgain 18 ) 19 20 //inside the jsx 21 .... 22 <Suspense fallback="Loading data.."> 23 <Data dataReader={dataReader} /> 24 </Suspense> 25 26 //inside <Data /> Component 27 ... 28 function Data({dataReader}){ 29 const data = dataReader() 30 return ( 31 <> 32 { 33 data.map(d => <div key={d.id}> {d.value} </div>) 34 } 35 </> 36 ) 37 }
The useAsyncResourceWithRecoil
hook accepts the following arguments:
Name | Type | Description | Default Value | Required |
---|---|---|---|---|
apiFunction | Function | Accepts an asynchronous function to call backend API | Yes | |
argumentsOfapiFunction | Array | Accepts an array of arguments for apiFunction eg: apiFunction(arg1, arg2, arg3) given as [arg1, arg2, arg3] | Yes | |
recoilAtom | RecoilState | Accepts a RecoilState that created using atom() from recoil | Yes | |
callOnlyOnFetchAgain | Boolean | if it is given as true then the apiFunction won't execute during the initialization and only executed on calling fetchAgain | false | No |
After being called, the useAsyncResourceWithRecoil
hook returns a result object with the following properties.
Name | Type | Description |
---|---|---|
dataReader | Function | invoke this function get the API results |
fetchAgain | Function | invoke this function to get results the API function again on dataReader() |
data | RecoilStateValue | value of the RecoilState or Recoil Atom |
setData | Function | A function to set the value of RecoilState |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/12 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- 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
89 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
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