Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
RecoilEnv.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED = false
in code to disable the checking and logging.process.env.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=false
in NodeJS environments such as NextJsparentStoreID_UNSTABLE
to atom effects which is the ID of the parent store it cloned from, such as the host <RecoilRoot>
store for useRecoilCallback()
snapshots. (#1744)children
prop to <RecoilRoot>
and useRecoilBridgeAcrossReactRoots_UNSTABLE()
for TypeScript for @types/react
with React 18 (#1718, #1717, #1726, #1731)toJSON()
. (#1709, #1703)<RecoilRoot>
's. (#1712)default
value is now optional for atom()
and atomFamily()
. If not provided the atom will initialize to a pending state. (#1639)getStoreID()
method to Snapshot
(#1612)RecoilLoadable.loading()
factory for making an async Loadable
which never resolves. (#1641)get()
and Atom's default
can now accept a Loadable
to put the node in that state. If you wish to store a Loadable
, Promise
, or RecoilValue
directly you can wrap it with selector.value()
or atom.value()
. (#1640)useRecoilCallback()
now provides a snapshot for the latest state when the callback is called instead of the latest rendered state, which had issues (#1610, #1604)setSelf()
from onSet()
handlers. (#1589, #1582)Window
interface. (#1571)Fix postInstall script
<StrictMode>
(#1473, #1444, #1509).useTransition()
using hooks with _TRANSITION_SUPPORT_UNSTABLE
suffix. (#1572, #1560)refresh()
to the useRecoilCallback()
interface for refreshing selector caches. (#1413)getCallback()
can now mutate, refresh, and transact Recoil state, in addition to reading it, for parity with useRecoilCallback()
. (#1498)<RecoilRoot>
and Snapshot
stores accessible via useRecoilStoreID()
hook (#1417) or storeID
parameter for atom effects (#1414).RecoilLoadable.all()
and RecoilLoadable.of()
now accept either literal values, async Promises, or Loadables. (#1455, #1442).isRetained()
method for Snapshots and check if snapshot is already released when using .retain()
(#1546)useRecoilTransaction_UNSTABLE()
(#1466, #1569)onSet()
handlers in atom effects when atoms are cleaned up. (#1509)onSet()
when atoms are initialized with <RecoilRoot initializeState={...} >
(#1519, #1511)<RecoilRoot>
will only call initializeState()
once during the initial render. (#1372)useGetRecoilValueInfo_UNSTABLE()
and Snapshot#getInfo_UNSTABLE()
results (#1549)effects_UNSTABLE
to just effects
, as the interface is mostly stabilizing. (#1520)<RecoilRoot initializeState={...} >
. (#1509)useGetRecoilValueInfo_UNSTABLE()
and Snapshot#getInfo_UNSTABLE()
always report the node type
. (#1547)