Skip to content

Instantly share code, notes, and snippets.

@cowboyd
Created December 19, 2023 14:43
Show Gist options
  • Save cowboyd/d00bb8a571da41d1115579e33b31a583 to your computer and use it in GitHub Desktop.
Save cowboyd/d00bb8a571da41d1115579e33b31a583 to your computer and use it in GitHub Desktop.
Operations resolve whenever they are ready to continue be it synchronously or asynchronously
import { call } from "effection";
function* getUser2(id: number) {
if (cachedUser) return cachedUser;
let response = yield* call(fetch(`/users/${id}`));
return yield* call(response.json());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment