From the course: React Foundations by Pearson

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Lab solution: calling REST services

Lab solution: calling REST services - React.js Tutorial

From the course: React Foundations by Pearson

Lab solution: calling REST services

Okay, so it's time for me to walk you through the solution code for Lab 6. So let's do that now. So this is the folder React Dev Solutions for Lesson 6. Index.html, that's the React web page that calls the REST service. Let's open that page in the code editor and walk through the code. So here is the solution for the React application, which calls the REST service. So notice it doesn't contain any hard-coded books or films. The library component, it receives. This is an interesting parameterization. It receives the REST base URL as a property. That kind of makes sense, doesn't it? It avoids hard-coding it in the component itself. Let's scroll down right to the bottom where this component is actually created. So, render my or instantiate my library component, pass in the REST base URL as a property, I quite like that, and tabulate display information in a tabular format. Right, well, let's go back up to library and see how it calls the REST services. So, scrolling up, up, up, here we…

Contents