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 with OpenWeatherMap to get an API key. We will use a free account as that is sufficient 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 weatherapp:

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

npx create-react-app ...

Get Hands-On Full Stack Development with Spring Boot 2 and React - Second Edition 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.