Gathering detailed insights and metrics for recoil-nexus
Gathering detailed insights and metrics for recoil-nexus
Gathering detailed insights and metrics for recoil-nexus
Gathering detailed insights and metrics for recoil-nexus
npm install recoil-nexus
Typescript
Module System
Node Version
NPM Version
76
Supply Chain
90.9
Quality
76.8
Maintenance
100
Vulnerability
99.6
License
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
162 Stars
70 Commits
13 Forks
6 Watchers
1 Branches
6 Contributors
Updated on Jun 03, 2025
Latest Version
0.5.1
Package Id
recoil-nexus@0.5.1
Unpacked Size
10.73 kB
Size
4.09 kB
File Count
8
NPM Version
10.2.3
Node Version
20.10.0
Published on
Jul 19, 2024
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
5
If you have been using recoil for a while, you might have faced that outside React Components it's not possible to get or update values from atoms.
This Typescript implementation will workaround the issue and let you do so.
npm
npm i recoil-nexus
yarn
yarn add recoil-nexus
RecoilNexus
in your RecoilRoot
1import React from "react"; 2import { RecoilRoot } from "recoil"; 3import RecoilNexus from "recoil-nexus"; 4 5export default function App() { 6 return ( 7 <RecoilRoot> 8 <RecoilNexus /> 9 10 {/* ... */} 11 </RecoilRoot> 12 ); 13} 14 15export default App;
Method | Returns |
---|---|
getRecoil | getter function |
getRecoilPromise | getter function, returns a promise. To be used with asynchronous selectors. |
setRecoil | setter function, pass value to be set or updater function as second parameter |
resetRecoil | pass atom as parameter to reset to default value |
Read current state:
1const loading = getRecoil(loadingState);
Setting the new state like this is not inherently wrong:
1setRecoil(loadingState, !loading);
However, if the new state depends on the previous one (like in this case), preferably use an updater function to correctly batch React state updates, as reading and updating the state at the same time could lead to unexpected results.
1import { setRecoil } from "recoil-nexus" 2 3export function toggleLoader() { 4 setRecoil(loadingState, loading => !loading) 5}
When testing in Jest, we need to set "transformIgnorePatterns": []
in our jest config, otherwise a SyntaxError: Cannot use import statement outside a module
will cause the tests to fail. This can be acheived one of the following ways, depending on how you are defining your jest config:
export default config
jest.config.js
"transformIgnorePatterns": []
package.json
"jest": {
"transformIgnorePatterns": []
},
Kudos to VeepCream's recoil-outside original idea and Javascript implementation.
In this Typescript port/enhancement, I decided to remove RxJS and rely on native Recoil promises and loadables only.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 3/25 approved changesets -- score normalized to 1
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
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