How to check the React version Quickly
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 property
We can use the React.version
property to check the current react version from a component.
Here is an example:
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 npm list react
command.
Here is an example:
npm list react
Output:
react@16.13.1
This above command work on both mac and windows based operating systems.
or you can view the react version by opening a package.json
file in your project.
{
"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",