Skip to content

4. mapReduceMaybePromise

Naveen Mathew edited this page Mar 6, 2024 · 2 revisions

mapReduceMaybePromise

useQwery only accepts a single onChange handler, but, it is useful to be able to split up a change handler into smaller handlers for maintainability and be able to compose them together. Change handlers are also required to return a Promise for onSuccess and onError to be invoked when it resolves/rejects.

mapReduceMaybePromise maps the input to the output of each change handler and if any handler returns a Promise, it returns a Promise<void> which resolves when all Promises have settled. Otherwise, it returns void.

Options

mapReduceMaybePromise accepts any number of functions