Is there a way to know the runtime version of React in the browser?
With the React Devtools installed you can run this from the browser console:
__REACT_DEVTOOLS_GLOBAL_HOOK__.renderers.forEach(r => console.log(`${r.rendererPackageName}: ${r.version}`))
Which outputs something like:
react-dom: 16.12.0
To know the react version, Open package.json file in root folder, search the keywork react. You will see like "react": "^16.4.0",
In index.js file, simply replace App component with "React.version". E.g.
ReactDOM.render(React.version, document.getElementById('root'));
I have checked this with React v16.8.1
From command line to view react version, npm view react version
Open Chrome Dev Tools or equivalent and run require('React').version
in the console.
That works on websites like Facebook as well to find out what version they are using.
For an app created with create-react-app I managed to see the version:
The app was deployed without source map.