Check the Version of ReactJS



ReactJS is a frontend library of JavaScript to build efficient Single Page Application(SPA). Each version of React comes with some improvements and added features. So, it is very important to know which version we are using.

Approaches to Check React Version

We can check the version of ReactJS by using the below-mentioned Approaches.

  • Using Command Line
  • Using ?React.version' Property
  • Searching in dependencies in package.json

React Version Using Command Line

We can use the below command to check the version of ReactJS. The below command shows the installed react version in our system.

npm view react version

React Version Check

React Version Using React.version Property

We can use the 'React.version' property to check the version of ReactJs installed in our system. The code mentioned below can be used to check the version of React using React.version property.

// file name - app.js
import React from "react";

const App = () => {
  return <h1> We are currently using {" "}{React.version} version of ReactJS </h1>;
};

export default App;

React Version Check

React Version Searching in package.json File

Apart from the two approaches mentioned above, we can simply search in our project's package.json folder to find the version of ReactJs we are using. Go to package.json file of the project then there will be a dependencies section, and the ReactJS version will be written there.

In the below image, we can see that the react version is "18.3.1" in the dependencies section.

React Version Check

Updated on: 2024-09-04T10:52:25+05:30

966 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements