We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework will include 3 major changes:
const R1 = createResource({ get: () => fetch(...), }); R1.get(); // { status: ResourceStatus.PENDING } await R1.get(); // { status: ResourceStatus.SUCCESS, value: Response } const R2 = createResource({ get: () => fetch(...), }); R2.get(); // { status: ResourceStatus.PENDING } await R2.get(); // { status: ResourceStatus.FAILED, error: Error }
const URL = createAtom({ default: '/', }); const A = createResource({ get: signal => fetch(URL.get(), { signal }), }); A.get(); // promise 1 await A.get(); // promise 1 URL.set('/foo'); A.get(); // promise 2 URL.set('/bar'); A.get(); // promise 3 & aborted promise 2
const A = createAtom({ default: 42, }) const C = createResource({ get: () => fetch(`/${A.get()}`) ); await C.get(); // network request await C.get(); // cached A.set(3); await C.get(); // network request await C.get(); // cached A.set(42); await C.get(); // cached A.invalidate(); await C.get(); // network request await C.get(); // cached
The text was updated successfully, but these errors were encountered:
WIP: ResourceStatus PromiseLike Resource
Sorry, something went wrong.
Olian04
No branches or pull requests
Rework will include 3 major changes:
The text was updated successfully, but these errors were encountered: