What should I do if I want to use connected-react-router for redux with react-router@6

59 Views Asked by At

I want to redirect after processing the operations file. However, connected-react-router cannot be used with react-router v6.

What is a way to resolve this?

operations.ts

import { push } from 'connected-react-router';

export function createMember(data: User) {
  return async (dispatch: Dispatch<Action>) => {
    // create members
    dispatch(push('/members')
  }
}

Is there a way to receive store changes in a file on the tsx side and redirect them with useNavigate()?

Or will it be solved by adding middleware to the store?

0

There are 0 best solutions below