by Sai gowtham

Checking the current React Version

In this tutorial, we are going to learn about multiple ways to check the current react version we are using in our project.

Using the React.version

We can use the React.version property to check the current react version from a component.

Example:

App.js
import React from "react";
import "./styles.css";

export default function App() {
  return (
    <div className="App">
      <h1>Current version is {React.version}</h1>    </div>
  );
}

Using the Terminal

Inside the terminal, we can check the react version by running the following (npm) command.

npm list react

Output:

react@16.13.1

or you view the react version by opening a package.json file in your project.

package.json
{
  "name": "react",
  "version": "1.0.0",
  "description": "React example starter project",
  "keywords": [
    "react",
    "starter"
  ],
  "main": "src/index.js",
  "dependencies": {
    "react": "16.13.1",    "react-dom": "16.13.1",

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
26,545 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
221,520 students enrolled
44 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
114,575 students enrolled
21 hours of video content
View Course