Sometimes it's helpful to review the basic building blocks of front end development. In this repo you'll find a few short exercises you can do to (re)familiarize yourself with the fetch
function.
This repo asks you to write two wrapper functions, get
and post
, that make interacting with the base fetch
api easier (and add some light additional functionality).
- Clone repo
- Run
yarn
- Run
yarn start
. You should see a page of failing tests onlocalhost:8000
. - Write code in
index.js
to solve the tests.
- Use the
debugger
statement liberally to introspect what is being returned by yourfetch
calls. - The tests expect your function to return an object that looks like this:
{ data: {}, error: {} }
, with eitherdata
orerror
keys depending on whether thefetch
request succesfully completed. - Possible solutions can be found in the
solutions
branch.