I am facing exactly the same problem as this other question where my Ionic react application caches some views so that when a user logs out and logs in directly with another account, they see for a few seconds the previous data (list of news for example) of the previous user. So the solution is to clear all the cached views when the user access the login view.
This solution proposes to add this code in the view:
$scope.$on("$ionicView.enter", function () {
$ionicHistory.clearCache();
$ionicHistory.clearHistory();
});
However this is not the same API used in Ionic v5 for react. I could replaced the event listener with:
import { useIonViewWillEnter } from '@ionic/react'
useIonViewWillEnter(() => {
// ...
})
But what is the equivalent of:
$ionicHistory.clearCache();
$ionicHistory.clearHistory();
I didn't find anything in the official doc so if someone has an idea I will really appreciate some help.