Saturday, November 16, 2024
Google search engine
HomeLanguagesHow to Check React App Version?

How to Check React App Version?

It is important to keep track of the version you are using, as updates can include new features, security patches, and bug fixes. Checking the version of React that you are using is a simple process that can be done in a few different ways. To check react js version; In this tutorial, You will learn several methods to check the version of React App.

Check the installed react app version is a very common thing. Because there are many ways or methods to check the version of React App. And this tutorial will show you about those methods. With this you can easily check the version of your installed react app.

How to Check React Version? [React JS Version]

Checking the version of React that you are using is a simple process that can be done in a few different ways.

  • 1 Method – Check the package.json file
  • 2 Method – To Check React Version by visiting the react.development.js
  • 3 Method – To Check React Version using App.js
  • 4 Method – Check to react version in terminal ubuntu using Command Line/CMD/Terminal
  • 5 Method – Check the browser console
  • 6 Method – Check react version on windows using the package.json file

1 Method – Check the package.json file

When you create a new React project, the version number of React is automatically included in the project’s package.json file. To check the version of React, open the file and look for the line that says “react” under the dependencies section. The version number will be listed next to it.

For example:

{
  ...
  ...
  ...
  "name": "react-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  },
  ...
  ...
  ...
}

2 Method – To Check React Version by visiting the react.development.js

The second method is also similar to the first method is very easy. For this you just have to open react.development.js file. Which you will find inside node_modules/react/cjs/ directory. And you can check the version of your react app here:

/** @license React v16.13.1
 * react.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

3 Method – To Check React Version using App.js

The third method is a little different. In this you have to open app.jsfile. Which you will find inside the Src directory. And then you have to add the following code to your app.js file:

import React from 'react'

function App() {
  return (
    <div className="App">
        Here is the Latest React version: <strong>{React.version}</strong>
    </div>
  );
}

export default App;

After this, you have to go to the terminal and execute the command given below. Which will start your React JS app:

npm start

4 Method – Check to react version in terminal ubuntu using Command Line/CMD/Terminal

The fourth way is very simple. Only you have to go to terminal and visit your react app by using cd /path/your_react_name command.

And when you will be in your react app directory on the terminal. So you execute the command given below. With this you can check the version of your React app:

npm view react version

Now you will see the version of React app installed on your terminal.

5 Method – Check the browser console

Another way to check the version of React being used is through the browser console. To do this, open your web application in a browser and open the browser console. This can typically be done by right-clicking anywhere on the page and selecting “Inspect” or “Inspect Element”, and then selecting the “Console” tab.

Once the console is open, type the following command:

React.version

6 Method – Check react version on windows using the package.json file

Another way to check the React version is to look at the package.json file in your project directory. Here’s how:

  1. Open your Terminal window.
  2. Navigate to your project directory.
  3. Type the following command in the Terminal window:
cat package.json

This will display the contents of the package.json file. Look for the “react” entry in the “dependencies” section. The version number will be next to it.

Conclusion

In conclusion, checking the version of React being used in your web application is an important step in maintaining and updating your application. By checking the package.json file, using the browser console, or looking at the source code, you can easily determine the version of React being used. Keeping your React version up-to-date can help ensure that your application is secure, reliable, and taking advantage of all of the latest features and improvements.

Recommended React Posts

RELATED ARTICLES

Most Popular

Recent Comments