const {history} = this.props;
history.push('/admin/user/create');
The above code is working in React 17 with React Router 5 but in React 18 with react Router 6 it is not working...
Can anyone help me out? I am using class-based components.
const {history} = this.props;
history.push('/admin/user/create');
The above code is working in React 17 with React Router 5 but in React 18 with react Router 6 it is not working...
Can anyone help me out? I am using class-based components.
Since react router v6 history changed to navigate : https://stackoverflow.com/a/63921034/8100188
I don't use class components but i found this for class components : https://stackoverflow.com/a/61612431
From the Docs: https://reactrouter.com/en/main/components/navigate
I've made a little research and what i found out is that in react router v6 they expect you to wrap your class components in a functional components where you can pass hooks as props as much as you'd like .
If you need more information: https://github.com/remix-run/react-router/issues/8146