Answers for "react router change route from function"

1

react router change route from function

import {withRouter} from 'react-router-dom';
this.props.history.push('route');
export default withRouter(your component name)
the react component should be wrapped with withRouter hoc 
so that history will work
Posted by: Guest on March-07-2021

Code answers related to "react router change route from function"

Code answers related to "Javascript"

Browse Popular Code Answers by Language