Ionic react lifecycles not working

Hello guys. I tried to use react lifecycles both through Class component and function component but none of them worked.
I’m using @ionic/react version 5.0.0

class component code:

import React from "react";
 import {
  withIonLifeCycle
} from "@ionic/react";

class NewProduct extends React.Component {
  ionViewWillEnter() {
    console.log("ionViewWillEnter event fired");
  }
render(){
return(<div></div>);
}
}
export default withIonLifeCycle(NewProduct);

what errors are you seeing?

Nothing happens when this component mounts. no Error and no call to ionViewWillEnter().

the answer is here :