How to check react version?

It is important to know how to check react version in order to keep the libraries and packages up to date. You can check the react and react-native versions either through command line or programmatically within your application code.

Check react version through command line

This will tell you the latest React and React-Native versions available on npm. It has nothing to do with your application.

npm view react version
npm view react-native version
check react and react native version from command line

Check version programmatically

You can use React.version to get the version which you are using in your application. This is useful because in different apps you could be using different versions. Command line can show you the latest version available on internet but this will provide you the version used in application.

import React from 'react';
function App(){
  const REACT_VERSION = React.version;
  return(
    <p>React Version: {REACT_VERSION}</p>
  )
}

    Tweet this to help others

Live Demo

Open Live Demo