Check React or React Native App Version Locally / Globally

This tutorial walks you through quickly checking the React application version through the command line, manually and programmatically. Also, you can learn how to find out all the installed packages in your React app.

Checking the React app version is not a difficult task; we will share a couple of methods through which you can quickly unfold the react app version.

Checking Version Manually

Open the pacakge.json file and jump over to the dependencies: {} section, and here you can see the React app version.

  "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"

Additionally, here is an another method to find out the React app version, head over tonode_modules/react/cjs/react.development.js file. The commented section speaking about the version itself.

/** @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.

Programmatically Showing React Version

Likewise, there is a simple and yet flexible way to show React version on the frontend. Just, add the given below few lines of code in src/App.js file.

import React from 'react'

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

export default App;

Execute the command via terminal window to check the React version.

npm start

Find React Version via Command

You have to execute the following command through your terminal window; it will manifest the current react version on your terminal screen.

npm view react version

# 16.13.1

Finding out React Native version is also very easy.

npm view react-native version

# 0.62.0

React Native Installed Global Version

Its easy to find out the globally installed version of React Native.

npm ls react-native -g
npm ls react-native -g

# /usr/local/lib
# └── react-native@0.61.5 

React Local Packages Details

Seldom, we require to have full knowledge of all the packages of the React app. But if so, then don’t worry. The below command can guide you about all the installed packages in your React app.

npm list --depth 0

Here is the output displayed on your terminal window:

#  react-app@0.1.0 /Users/user/Desktop/react-app
#  ├── @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

I hope these methods will help you.