{"id":11880,"date":"2022-02-08T11:03:14","date_gmt":"2022-02-08T16:03:14","guid":{"rendered":"http:\/\/local.brightwhiz\/?post_type=snippets&p=11880"},"modified":"2022-02-08T11:03:15","modified_gmt":"2022-02-08T16:03:15","slug":"how-to-get-react-version","status":"publish","type":"snippets","link":"http:\/\/local.brightwhiz\/snippets\/how-to-get-react-version\/","title":{"rendered":"How to Get the React Version With npm or Script"},"content":{"rendered":"\n
You can use this command in your terminal to view which version of React is used for your app.<\/p>\n\n\n\n
$ npm view react version\n$ npm view react-native version<\/code><\/pre>\n\n\n\nFrom with React app:<\/p>\n\n\n\n
<script src="https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/react\/15.1.0\/react.min.js"><\/script>\n<script src="https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/react\/15.1.0\/react-dom.min.js"><\/script>\n\n<script>\n const REACT_VERSION = React.version;\n\n ReactDOM.render(\n <div>React version: {REACT_VERSION}<\/div>,\n document.getElementById('root')\n );\n<\/script><\/code><\/pre>\n\n\n\nAdd this to your HTML body element:<\/p>\n\n\n\n
<div id="root"><\/div><\/code><\/pre>\n","protected":false},"comment_status":"open","ping_status":"closed","template":"","meta":[],"categories":[953,15],"tags":[954,328,471,501,638],"yoast_head":"\nHow to Get the React Version With npm or Script<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n