How to Check or Verify React App Version

This tutorial helps you find out the React app version through various methods. Sometimes, we need to ascertain the React app version we are currently working on; well, this simple guide can help you recognise the react app version locally as well as globally.

React Version in Package.json

The package json file conjugates the package details, app version, and other types of essential information.

Open the package.json file to find out the React app version in the second place; this is an easy way to validate the react app version.

...
...
{
  "name": "react-demo",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.12.0",
    "@testing-library/react": "^11.2.6",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.1.1"
  },
...
...
...
...

React Version via Node Modules

We would like to share another effortless way to find out React version via node_modules, and you need to open node_modules/react/cjs/react.development.js file and look for the app version, especially in the commented segment at the top portion of the file.

/** @license React v16.13.1
 * react-is.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.
 */

...
...
...
...

Get React App Version Dynamically

In the next step, we are uncovering another method through which you can get the react app version, not just that you can view react app version on the frontend.

Head over to the src/App.js file and call the React.version, and after that, start the application and view the version on the browser.

import React from 'react'

function App() {
  return (
    <div className="App">
        React version: { React.version }
    </div>
  );
}

export default App;

Make sure to start the app using npm start command.

Use Terminal to Check React App Version

You may also use your terminal to get the react app version, and you need to open the terminal window then type the given below command in the command prompt.

You may get the react and react-native versions; make sure to execute either of the command.

# React
npm view react version


# React native
npm view react-native version

The above command will manifest the current app version on the terminal screen.

React check app version tutorial is over; in this example we demonstrated basic ways by which you can get to know about the react application version. We are sure this tutorial will help you; please share it with others.