May 2019
Intermediate to advanced
496 pages
10h 38m
English
CustomerForm is not the only component we'll use that will call fetch. In fact, the fetch tests we've written in this chapter will be a common occurrence in our code base. It makes sense to reuse the common code we've used, by pulling it out into its own module:
export const fetchResponseOk = body => Promise.resolve({ ok: true, json: () => Promise.resolve(body) });export const fetchResponseError = () => Promise.resolve({ ok: false });
Read now
Unlock full access