react version code example

Example 1: check react version

npm view react version
npm view react-script version

Example 2: get react version

// To view which version of React is/was used for a particular app, type in the below in commandline/terminal.
npm view react version
npm view react-native version

Example 3: react latest version

//Is used to update the version only; such as 16.0.0 can be update to latest 16.13.0 but.. 
//but.. 15.0.0 can't be updated to 16.13.0 or to 16.0.0 with this
npm update react

//Use this to go from 15.0.0 to 16.13.0
npm install --save react@latest

Example 4: react 17 install

const rootNode = document.getElementById('root');
ReactDOM.render(<App />, rootNode);

Example 5: react native version

{  "name": "AwesomeProject",  "version": "0.0.1",  "scripts": {    "start": "node node_modules/react-native/local-cli/cli.js start",+   "postversion": "react-native-version"  }}

Example 6: react native version

$ npm install react-native-version --save-dev# or $ yarn add react-native-version --dev