From the course: React Native Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Fetching more API data for a view

Fetching more API data for a view - React Native Tutorial

From the course: React Native Essential Training

Start my 1-month free trial

Fetching more API data for a view

- [Narrator] We wired the on press event for every deal, and now we can go to a deal detail view. It's now time to fetch the extra details from the server. We're going to need another Ajax function. In Ajax.js, just like the fetch initial deals function, we now need another function. We'll call this function fetch deal detail. And this function is going to need the deal ID 'cause that's how we're going to use the API. We need a deal ID to ask the API server for information on one deal. So the code here is exactly the same, except that we want to do slash here and add the deal ID. And this should work to give us information on a single deal. By the way, I don't need these to be let variables, I'm going to change them all to just const. Whenever you can use const, you should. There's actually an Eslint rule for that. So if I undo this to let and go to my Eslint file, the rule is to prefer const and we'll do that as an error.…

Contents