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
2 answers

ESLint: Getting the error "React Hook useEffect has missing dependencies"

I am currently making a TodoList app using Recoil and React and I am getting the error: Line 45:6: React Hook useEffect has missing dependencies: 'setTodoList' and 'todoList'. Either include them or remove the dependency array …
atman_lens
  • 474
  • 2
  • 6
  • 16
0
votes
1 answer

Recoil: Passing a long-lived client object to a selector

Coming from react-redux / redux-thunk, there is a nice way of instantiating a client object once, passing it to ThunkMiddleware, and retrieving it in thunks: // This is the instance I want during async calls const myApiClient = new…
0
votes
1 answer

React useEffect hook does not call after recoil atom updated

I'm using recoiljs as my state manager for my react project, and one of my components doesn't call it's useEffect when a recoil atom changes from another file. Here is my main component that reads from an atom. import React, {useState, useEffect}…
feverdreme
  • 467
  • 4
  • 12
0
votes
3 answers

Type 'IConnectionState' is not assignable to type '{ connected: false; type: "none"; }'

So, I think my typescrpt linter is short circuiting because, I cant for the life of me figure out why this linting error keeps being raised. Type 'IConnectionState' is not assignable to type '{ connected: false; type: "none"; }' Below is my code,…
Ja Superior
  • 459
  • 4
  • 17
0
votes
1 answer

React/Recoil: once state is set in the main app, cannot be set again inside a component?

After I set the state from the loadable within the App.js file: import React from 'react'; import { useRecoilState, useSetRecoilState, useRecoilValueLoadable } from 'recoil'; import './App.css'; import { Point } from './components/Point'; import {…
James Harrison
  • 323
  • 4
  • 12
0
votes
2 answers

React Recoil useRecoilValue is returning an empty atom

I am having an issue with getting the value from a global atom. I have index.js routes.js and then in components i have a home page and a collage page. The home page is a list of dog names and an image of each. The user will select a dog and then…
robert
  • 63
  • 7
0
votes
1 answer

There is an error popping up while using React Recoil

I was just trying to learn React Recoil. And encountering the following issue. Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object Just followed the steps…
0
votes
1 answer

Usage of recoil in custom NPM component

I'm trying to use recoil in a custom npm component so that I can publish and use it in an application but upon usage getting error as below: Invalid hook call. Hooks can only be called inside of the body of a function component... > const…
Suraj A J
  • 359
  • 4
  • 19
0
votes
1 answer

React Recoil state not being reset properly

I have some recoil state, that i want to reset. import { useRecoilValue, useResetRecoilState, useSetRecoilState } from 'recoil'; ... //should be used for flushing the global recoil state, whenever a user submits an invoice const…
Kristoffer Tølbøll
  • 3,157
  • 5
  • 34
  • 69
-1
votes
1 answer

TypeError: Object(...) is not a function ReactJS + Recoil

I am using ReactJs and Recoil. When exporting an atom and importing it into App.js, I get a TypeError: Object (...) is not a function, what is the problem? atoms.js: import atom from 'recoil'; export const textState = atom({ key:…
Denis
  • 65
  • 2
  • 7
-1
votes
1 answer

how to implement typical use-case with recoil

I have a parent components, A, and child components B & C. I need to share a list between B & C, say a list of todos. Child C can add/delete an item in the todo list. Assume that the todo list is backed by an async service. I have put together an…
user1763729
  • 167
  • 1
  • 11
-3
votes
1 answer

Error: Invalid argument to useRecoilState: expected an atom or selector but got undefined

I got this error but I have no idea why I got this error. I did everything fine. I am using useRecoilState in Next JS to manage my state. Here's the link to repo: https://github.com/dingus45191/Radiant-Covid-Emergency-Site Works now just remove any…
Dingus45191
  • 532
  • 1
  • 7
  • 19
-3
votes
2 answers

Cannot assign to read only property with .map(). Recoil with NextJs

before I use only nextJs everything is good to go but after I try to use recoil and I try to assign new value to array object by using .map() but the error show up Cannot assign to read only property Here is my example Array object const…
Akw
  • 91
  • 2
  • 11
1 2 3
17
18