Continuation of Recoil - A state management library for React
npm install recoil-next   
A continuation of the Recoil state management library for React.
The official Recoil project is no longer maintained. This fork provides:
- Active maintenance and bug fixes
- React 18+ compatibility
- Full TypeScript support
- Modern build tooling (Vitest, Rollup, ESLint)
``shell`
npm install recoil-next
Or with pnpm/yarn:
`shell`
pnpm add recoil-nextor
yarn add recoil-next
`tsx
import {atom, selector, useRecoilState, useRecoilValue, RecoilRoot} from 'recoil-next';
// Define an atom
const countState = atom({
key: 'countState',
default: 0,
});
// Define a selector
const doubleCountState = selector({
key: 'doubleCountState',
get: ({get}) => get(countState) * 2,
});
// Use in components
function Counter() {
const [count, setCount] = useRecoilState(countState);
const doubleCount = useRecoilValue(doubleCountState);
return (
Count: {count}
Double: {doubleCount}
// Wrap your app with RecoilRoot
function App() {
return (
);
}
`
Replace recoil with recoil-next in your imports:
`javascript
// Before
import {atom, selector, useRecoilState} from 'recoil';
// After
import {atom, selector, useRecoilState} from 'recoil-next';
``
All APIs remain identical to the original Recoil library.
See the original Recoil documentation: https://recoiljs.org/docs/introduction/core-concepts
Check out the examples directory for usage examples.
- Code of Conduct
- Contributing Guide