For the functional component, I have used withRouter for redirect to another component like below:
const buttonClick = (history) => {
history.push('/spot');
};
const Topleft = withRouter(({history}) => {
return ( );
});
export default Topleft;
I want to does exactly the same thing for the class component. Like Below:
class TopLeft component {
render(){
return()
}
}
export default Topleft;
How can I do that? Can anyone please help.
Topleft:export default withRouter(Topleft);