Skip to content

Instantly share code, notes, and snippets.

Last active Oct 25, 2020
What would you like to do?
import useAsyncEffect from '@n1ru4l/use-async-effect';
function* (onCancel, c) {
const controller = new AbortController();
onCancel(() => controller.abort());
const data = yield* c(search(controller));
const search = controller => fetch('someURL', { signal: controller.signal }).then(r => r.json());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment