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.3 to 0.1.4

2

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

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

@@ -47,11 +47,8 @@ # R E C O I L - N E X U S

\
| Hook | Returns |
| :------------- | :----------- |
| `useRecoilNexus` | getter/setter tuple |
| `useRecoilNexusValue` | getter only, which will return a promise |
| `useRecoilNexusSetValue` | setter function |
| `getRecoil` | getter function, returns a promise |
| `setRecoil` | setter function |
\

@@ -61,10 +58,9 @@ ```tsx

import { loadingState } from '../atoms/loadingState'
import { useRecoilNexus } from 'recoil-nexus'
import { getRecoil, setRecoil } from 'recoil-nexus'
export default async function toggleLoading() {
const [getLoading, setLoading] = useRecoilNexus(loadingState)
const loading = await getLoading()
const loading = await getRecoil(loadingState)
setLoading(!loading)
setRecoil(loadingState, !loading)

@@ -76,4 +72,4 @@ }

//Loader
import React from 'react'
import { useRecoilNexus } from 'recoil-nexus'
import React from "react"
import { useRecoilValue } from "recoil"

@@ -97,33 +93,2 @@ export default function Loader() {

```
## ESLint Warning
Despite these hooks are fully functional, they **will trigger ESLint rules**.
```
React Hook "useRecoilNexus" cannot be called at the top level.
React Hooks must be called in a React function component or a custom React Hook function
react-hooks/rules-of-hooks
```
```
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 üseRecoilNexus } from 'recoil-nexus'
```
- or disable es-lint rule for the single line:
```tsx
// eslint-disable-next-line react-hooks/rules-of-hooks
```
- or disable the Hooks Rule for the whole file (...not recommended):
```tsx
/* eslint-disable react-hooks/rules-of-hooks */
```
_____________

@@ -130,0 +95,0 @@ ### Credits

Sorry, the diff of this file is not supported yet

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