Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

recoil-nexus

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recoil-nexus - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

2

package.json
{
"name": "recoil-nexus",
"version": "0.1.2",
"version": "0.1.3",
"description": "A small Typescript package to access your Recoil atoms outside of React components.",

@@ -5,0 +5,0 @@ "main": "build/RecoilNexus.js",

@@ -43,18 +43,20 @@ # R E C O I L - N E X U S

export default App;
```
### 2. Use hooks to get/set values: keep in mind that the GET value will return a Promise.
<br/>
\
| Hook | Returns |
| :------------- | :----------- |
| `useRecoilNexus` | returns getter/setter tuple |
| `useRecoilNexusValue` | returns getter only, which will return a promise |
| `useRecoilNexusSetValue` | returns setter function |
<br/>
| `useRecoilNexus` | getter/setter tuple |
| `useRecoilNexusValue` | getter only, which will return a promise |
| `useRecoilNexusSetValue` | setter function |
\
```tsx
// Loading example
import { loadingState } from '../atoms/loadingState'
import { useRecoilNexus, useRecoilNexusValue, useRecoilNexusSetValue } from 'recoil-nexus'
import { useRecoilNexus } from 'recoil-nexus'

@@ -94,4 +96,4 @@ export default async function toggleLoading() {

## Warning
Using them on the top level of a file is fully functional, **however** it will trigger es-lint checker.
## ESLint Warning
Despite these hooks are fully functional, they **will trigger ESLint rules**.

@@ -105,6 +107,13 @@ ```

```
React Hook "useRecoilNexus" is called in function "toggleLoading" which is
neither a React function component or a custom React Hook function
react-hooks/rules-of-hooks
```
### To workaround this you can either:
- import with an alias
```tsx
import { useRecoilNexus as _useNexus } from 'recoil-nexus'
import { useRecoilNexus as üseRecoilNexus } from 'recoil-nexus'
```

@@ -115,3 +124,3 @@ - or disable es-lint rule for the single line:

```
- or disable the Hooks Rule for the whole file (not recommended):
- or disable the Hooks Rule for the whole file (...not recommended):
```tsx

@@ -124,2 +133,1 @@ /* eslint-disable react-hooks/rules-of-hooks */

This is a Typescript port + enhancement of [VeepCream](https://github.com/VeepCream)'s [recoil-outside](https://www.npmjs.com/package/recoil-outside).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc