jotai-recoil-adapter
: a community project for making life easier when migrating from Recoil to Jotai
#2342
Unanswered
clockelliptic
asked this question in
Show and tell
Replies: 1 comment
-
see: https://github.com/clockelliptic/jotai-recoil-adapter Update: v0.4.0Adds support for atom and atomFamily effects: export type EffectArgs<T> = {
/* supported */
onSet: (cb: (newVal: T, oldVal?: T) => void) => void;
getPromise?: GetPromise;
getLoadable?: GetLoadable;
node?: AtomAdapter<T>;
setSelf?: (value: T) => void;
/* unsafe/messy to support */
resetSelf?: UNSUPPORTED;
/* does not apply to Jotai */
storeID?: UNSUPPORTED;
trigger?: UNSUPPORTED;
getInfo_UNSTABLE?: UNSUPPORTED;
parentStoreID_UNSTABLE?: UNSUPPORTED;
};
export type EffectFn<T> = (arg: EffectArgs<T>) => void; Adds support for export type Loadable<T> =
| { state: "hasValue"; contents: T }
| { state: "hasError"; contents: Error }
| { state: "loading" };
export type GetPromise = <T>(atom: AtomAdapter<T>) => Promise<T>;
export type GetLoadable = <T>(atom: AtomAdapter<T>) => Loadable<T>;
export type Snapshot = {
getPromise: GetPromise;
getLoadable: GetLoadable;
retain: () => () => void; // does nothing, merely for drop-in convenience
}; Supported or partially supported APIsimport {
/* standard Recoil APIs, fully or partially supported */
RecoilRoot,
atom,
atomFamily,
selector,
selectorFamily,
useRecoilCallback,
useRecoilState,
useRecoilValue,
useSetRecoilState,
useResetRecoilState,
useRecoilBridgeAcrossReactRoots_UNSTABLE,
/* interfaces, fully or partially implemented */
Snapshot,
Loadable,
/* special adapters for compatibility */
atomAsync,
atomFamilyAsync,
asyncSelector,
asyncSelectorFamily,
selectorDefault
} from 'jotai-recoil-adapter'; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone 👋,
TLDR; Check out clockelliptic/jotai-recoil-adapter. It's rough around the edges and could use community support, but has proven to be very useful so far. Please feel invited to contribute, fork, and copy as needed.
see it on NPM: https://www.npmjs.com/package/jotai-recoil-adapter
🔍 What is jotai-recoil-adapter?
The
jotai-recoil-adapter
is intended to facilitate a less-painful transition from Recoil to Jotai. It provides an API compatible with Recoil while leveraging the simplicity and efficiency of Jotai under the hood. Our goal is to make it easier for teams reliant on Recoil to migrate to Jotai without having to overhaul their existing codebases.🌟 Features Include:
atom
,selector
,useRecoilState
, and more.🤝 We Need Your Input!
This project is in its early stages, and community input is invaluable.
Current top priorities include:
🔗 Get Involved:
Beta Was this translation helpful? Give feedback.
All reactions