Is there a way to know the runtime version of React in the browser?
React.version is what you are looking for.
It is undocumented though (as far as I know) so it may not be a stable feature (i.e. though unlikely, it may disappear or change in future releases).
Example with React imported as a script
const REACT_VERSION = React.version;
ReactDOM.render(
React version: {REACT_VERSION},
document.getElementById('root')
);
Example with React imported as a module
import React from 'react';
console.log(React.version);
Obviously, if you import React as a module, it won't be in the global scope. The above code is intended to be bundled with the rest of your app, e.g. using webpack. It will virtually never work if used in a browser's console (it is using bare imports).
This second approach is the recommended one. Most websites will use it. create-react-app does this (it's using webpack behind the scene). In this case, React is encapsulated and is generally not accessible at all outside the bundle (e.g. in a browser's console).