
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-version-tracker
Advanced tools
This module will be used to detect the version change of the application
Version tracking can be done
Install react-version-tracker with npm
npm install react-version-tracker
Install react-version-tracker with yarn
yarn add react-version-tracker
import Component in app level
import { VersionTracker } from 'react-version-tracker';
in app.js add the below code
<VersionTracker
currentVersion='v1.0.0'
versionFileUrl='version.json'
onVersionChange={onVersionChange}
/>
| Prop | Type | Default | Description |
|---|---|---|---|
| currentVersion | String | This will be the current version of the build | |
| versionFileUrl | String | /version.json | this can be file location or any API |
| displayAlert | Boolean | false | when there is change alert will be displayed |
| onVersionChange | Function | when the version change method will be called | |
| message | String | user message on the alert box. |
Example
when we keep the version file in the web server simple pass the file name
versionFileUrl="version.json".
or
versionFileUrl="http://text.com/api/get-version"
{ "version":"1.0.0" }
this funtion will return object {"version":"1.0.0"}
react-version-tracker has two hooks useVersionTracker and useVersion . we have to do client and server side changes to use hooks
we need to pass response of API to useVersionTracker . it has two params first is the response second one is the key of response header. useVersionTracker hook can be added to the axios response interceptor or in the HTTP service.
Sample 1
import { useVersionTracker } from 'react-version-tracker';
fetch(url, {
method: method,
body: JSON.stringify(data),
headers: headers,
params: params,
}).then((response) => {
useVersionTracker(response, 'X-Version');
return response.json();
})
Sample 2
import axios from 'axios'
import { useVersionTracker } from 'react-version-tracker';
axios.interceptors.response.use(
response => {
useVersionTracker(response, 'x-version')
return response
},function (error) {
return Promise.reject(error)
})
When any version change is detected new version will be returned by useVersion hook
const { version } = useVersion();
useEffect(() => {
if (version !== currentVersion) {
// write your logic here
}
}, [version]);
Node JS changes from api response.
let results= {};
response.header('Access-Control-Expose-Headers', 'x-version');
response.set('x-version', '1.0.0');
return response.send(results);
Display modal instead of alert
Give the option to auto-reload in VersionTracker
Add auto-reload and Display alert option in useVersionTracker
FAQs
React version tracker
We found that react-version-tracker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.