how to check the previous history location in react code example
Example: react history listen get previous location
let prevLocation;
history.listen(nextLocation => {
console.log(prevLocation);
// ...
prevLocation = nextLocation;
});
let prevLocation;
history.listen(nextLocation => {
console.log(prevLocation);
// ...
prevLocation = nextLocation;
});