DEV Community

Martin Soderlund Ek
Martin Soderlund Ek

Posted on

React Sample App with API Call and Update to Latest Version

A while back I created a small and simple React app in order to fetch a random user from the RandomUser.me API.

You can find the React app on my GitHub: hello-react

I have a RandomUser component which simply looks like this:

We fetch a user from the API and present the user's name and picture, if present.

In our App.js file we then return the RandomUser component together with some HTML:

In the VS Code terminal we run the npm start command and our React app is compiled and we can look at it in the browser on http://localhost:3000/.

After commit to Github, I got a few security messages back, as expected.

First, I checked React version with this command:

npm list react

and got -- react@16.8.6 back, which isn't the latest version. To install latest React version, I had to run this command:

npm install --save react@latest

And then update packages in the React app with this command:

npm audit fix

I also manually had to update lodash.template to 4.5.0:

npm install --save lodash.template@latest

You can find the React app on my GitHub: hello-react @ dileno

Top comments (0)