Practical examples

We will go through two examples of using some open REST APIs. First, we will make a React app that shows the current weather in London. The weather is fetched from OpenWeatherMap (https://openweathermap.org/). You need to register to OpenWeatherMap to get an API key. We will use a free account as that is enough for our needs. When you have registered, navigate to your account info to find the API keys tab. There you'll see the API key that you need for your React weather app:

Let's create a new React app with create-react-app. Open the PowerShell or other terminal you are using, and type the following command:

create-react-app ...

Get Hands-On Full Stack Development with Spring Boot 2.0 and React now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.