Hi I have a little problem using the ionic framework on react, what i want is when i click the login button it will navigate to homepage, the current behavior in my code is when typing in the browser url /homepage
it works well but when clicking the button login it didnt navigate to homepage, I dont know why, any ideas?
Login.tsx
const Login: React.FC = () => {
const history = useHistory();
const homepage = () =>{
console.log("ss")
history.push("/homepage");
}
return (
.....
<IonButton onClick={homepage} color="success" shape="round" size='default' className='submitButton'>
<span className='login-button'>Login</span>
</IonButton>
)
}
App.tsx
const App: React.FC = () => (
<IonApp>
<IonReactRouter>
<IonRouterOutlet>
<Route exact path="/login">
<Login/>
</Route>
<Route exact path="/homepage" component={Homepage}></Route>
<Route exact path="/">
<Redirect to="/login" />
</Route>
</IonRouterOutlet>
</IonReactRouter>
</IonApp>
);