React lifecycle hook

hi,
I am trying react lifecycle hooks, and useIonViewDidEnter and useIonViewWillEnter are triggering even I route to different page. but I dont want to them to fiire other pages, is there a different lifecycle hook for for page level ?

 useIonViewDidEnter,
  useIonViewDidLeave,
  useIonViewWillEnter,
  useIonViewWillLeave

Do you have an example of how you’re using them?