Use Fetch to Load External Data in React Native

Tyler McGinnis
InstructorTyler McGinnis

Share this video with your friends

Send Tweet

The way you make HTTP requests in React Native is with fetch. In this video, we'll add integration with the github API into our app using fetch.

Sam Couch
Sam Couch
~ 6 years ago

How would you go about appending a header to your request?

The approach that I took was: https://gist.github.com/samuelcouch/5d2b860a11f395f250a0

But all I get is an error that says "Can't find variable Headers" referencing line 4.

Sam Couch
Sam Couch
~ 6 years ago

...Preemptively posted this... Found the solution after looking in to Headers source. It just builds an object for you.

valentin
valentin
~ 6 years ago

When I link the api component to the main.js, I get a surprising message error: Requiring unknown module "../Utils/api". If you are sure the module is there, try restarting the packager. What does it mean to restart the packager ?

Anders
Anders
~ 5 years ago

I think the "back-tick templating thingy" is known as "interpolation"