Skip to content

Glossary: React Beyond the Basics

readJson

A helper function in `api.ts` that parses a fetch response as JSON and throws an `Error` if `response.ok` is false. Query functions must throw on errors so TanStack Query can report them.

Where the book teaches it

Related terms

fetchresponse.okuseQuery