There are several ways to get the current version of a deployed React application in the browser, but one recommended approach is to use a package called "react-scripts" which comes with Create React App, a popular React development tool.
To get the current version using react-scripts, follow these steps:
- Install react-scripts by running the following command in your project's root directory:
npm install react-scripts --save-dev
- In your React app, create a new file called version.js in the public folder.
- Inside the version.js file, add the following code: