Questions tagged [recoiljs]

A state management library for React.

Recoil is a minimal library that provides an experimental set of utilities for state management with React.

  • Minimal and Reactish: Recoil works and thinks like React. Add some to your app and get fast and flexible shared state.
  • Data-Flow Graph: Derived data and asynchronous queries are tamed with pure functions and efficient subscriptions.
  • Cross-App Observation: Implement persistence, routing, time-travel debugging, or undo by observing all state changes across your app, without impairing code-splitting.

Recoil lets you create a data-flow graph that flows from atoms (shared state) through selectors (pure functions) and down into your React components. Atoms are units of state that components can subscribe to. Selectors transform this state either synchronously or asynchronously.


Useful links


Related tags


Reference

268 questions
0
votes
1 answer

useMemo for efficient global data availability using reactJS and recoilJS

I am trying to figure out how to solve the following problem in the best way possible: I have multiple components all requiring a global state (I am using recoil for this, since I have many different "atom" states). Only if a component gets loaded…
0
votes
1 answer

Using recoil selector to filter component data?

I feel like i've read so many examples/docs and watched videos but i can't get my head around using selectors with recoil. Maybe i'm just having a bad day cause i don't think it's that hard. This is where i'm at... lets say i have data like: const…
Liiaam93
  • 195
  • 1
  • 2
  • 10
0
votes
1 answer

Next-i18Next Blocking Global State in NextJS

I am using RecoilJS to pass global state between two pages in Next. This works fine, until I use next-i18next in the page receiving the variables. If I comment out the next-i18next code in the getServerSideProps of the receiving page, the Recoil…
Ray Purchase
  • 681
  • 1
  • 11
  • 37
0
votes
1 answer

Reset state of atomFamily

Is there an easy way to reset state of an atomFamily? For individual atoms there's useResetRecoilState or reset within useRecoilTransaction_UNSTABLE. Without such a hook or function, the client must iterate over a stored list of keys in order to…
Taylor Johnson
  • 1,845
  • 1
  • 18
  • 31
0
votes
2 answers

Atom dictionary structure

I receive data from a websocket in my react app. The data holds prices for stock symbols: {symbol: "aapl", price: 150} I want to save the price for each stock in an individual Atom, where the key is the symbol and data is the price. There could be…
0
votes
1 answer

reset recoil state to default not working

tried to reset recoil state to its default value using useResetRecoilStatebut not working This is my code import {filter} from '..appl/recoil/atoms'; import { useResetRecoilState } from 'recoil'; let filterReset = () => {…
vrooom
  • 51
  • 1
  • 11
0
votes
0 answers

Adding new layers to Deck.GL Map in React

What is the correct way to add layers to a Deck.GL map, when using the React component? I'm building an app using React, Deck.GL as the mapping library, and Recoil for state management. All three are new to me, so there's been a steep learning…
Jesse Reilly
  • 186
  • 2
  • 11
0
votes
1 answer

Modify values in a selector - Recoil

I am fetching an API, destructuring it and storing values into individual selectors. I want to update a certain selector. I am able to do it using const connection = useRecoilValue(connectionState); const setConnection =…
arunmmanoharan
  • 2,535
  • 2
  • 29
  • 60
0
votes
0 answers

Call an API store it in an atom - Recoil

how do I call an API and store it in an atom? The API needs a parameter from the component, so I use selectorFamily. import { atom, atomFamily, selector, selectorFamily } from 'recoil'; import { load } from '../../services/config'; import {…
arunmmanoharan
  • 2,535
  • 2
  • 29
  • 60
0
votes
1 answer

name space React has no exported member 'node'

I'm trying to make a function do debug recoil state. I'm copying the debug observer from recoil import React, { useEffect } from 'react' import { useRecoilSnapshot } from 'recoil' function DebugObserver(): React.node { const snapshot =…
angry kiwi
  • 10,730
  • 26
  • 115
  • 161
0
votes
2 answers

recoil is there a way to do additional actions when the atom state changes?

I am managing the theme state as an atom of recoil. If the user changes the theme through the ui, the corresponding atom state will change. I want to save the theme value changed here to localstorage. To do that, we need to know when that state…
Kyungeun Park
  • 113
  • 1
  • 10
0
votes
0 answers

Best way to manage shop products in an ecommerce store with React JS?

I'm a beginner in react and need a bit of expert advice for managing products in react JS, I also need to implement filtration with various fields. May I store all products in state and perform the process manually or hit the API each time the page…
0
votes
0 answers

How can I show detail value of Recoil Extension on Chrome

Here is my Recoil Extension, How can I see my state on this
0
votes
0 answers

add to cart in React, javascript, RecoilJS

i am creating a shopping Cart passing an object on Click, if cart is Empty add the object, if existing object increment the Quantity Data: { id:4, productName:'Grapes', price:69, quantity:1} Code const [cart, setCart] =…
ASIF KAIF
  • 317
  • 1
  • 4
  • 17
0
votes
1 answer

add object to an existing array of objects React Recoil

i want to add a new object to an array of objects when id does not match in react recoil const [cart, setCart] = useRecoilState(cartItems) object {id:1, quantity:1, productName:'apple'} const addToCart =(object) => { …
ASIF KAIF
  • 317
  • 1
  • 4
  • 17