Please am I the only going through this issue with IONIC REACT, where pages remain the same even I leave and come back

Like how can I clear the previous state of the last page, I have tried using UseIonViewWillLeave or UseIonDidLeave

Can you provide a sample code?