connected-react-router icon indicating copy to clipboard operation
connected-react-router copied to clipboard

Upgrade to RRv6?

Open Brodzko opened this issue 5 years ago • 17 comments

react-router is about to release v6 soon (as of today, v6.0.0-alpha.2 is out). Will connected-react-router be compatible with the new version, or is an upgrade planned soon?

Sorry if I missed any info on this.

Brodzko avatar Mar 02 '20 21:03 Brodzko

I just started working on it on the dev branch. Now, it passes all unit tests, but I haven't tested it on some sample apps and will do during weekends. Feel free to check it out and let me know if it works.

Note that there is a minor issue on RRv6 on history listening that causes a memory leak warning. I tried to fix it in this PR https://github.com/ReactTraining/react-router/pull/7195.

supasate avatar Mar 18 '20 03:03 supasate

@supasate Could you maybe release a preview version that's working with v6? I'd like to test it in my project and give feedback 🙂

lukasluecke avatar May 14 '20 18:05 lukasluecke

Just bumping this issue and echoing the request for a preview version release (if possible)! react-router v6 entered beta stage about a month ago, and I'm looking forward to upgrading to and using the latest versions of these packages.

stephenkao avatar Jul 14 '20 14:07 stephenkao

Hello. I created a temporary solution for react-router 6 navigation from redux-saga (a very simple version of connected-react-router). It includes redux middleware, reducer, one action (push), and BrowserRouter component. You can try it unless the new version of connected-react-router will have been created. https://gist.github.com/nikakoy131/09cbbaa2563871ff2d2955c7681a3727 It very poor tested, and have @reduxjs/toolkit and typescript as dependency Usage: Configure store

// in store.ts
import { createBrowserHistory } from 'history';
import { configureStore } from '@reduxjs/toolkit';
import { routerReducer, routerMiddleware } from './customReduxRouter';
const sagaMiddleWare = createSagaMiddleware();
export const history = createBrowserHistory({ window });
const store = configureStore({
  reducer: {
    router: routerReducer,
  },
  middleware: [sagaMiddleWare, routerMiddleware(history)],
});

sagaMiddleWare.run(rootSaga);

export type AppState = ReturnType<typeof store.getState>;

export default store;

In your index.tsx

import App from './App';
import store, { history } from './redux/store';
import { BrowserRouter } from './redux/customReduxRouter';
ReactDOM.render(
  <Provider store={store}>
    {/* <ConnectedRouter history={history}> */}
    <BrowserRouter history={history}>
      <App />
    </BrowserRouter>
    {/* </ConnectedRouter> */}
  </Provider>,
  document.getElementById('root'),
);

In your saga

import { routerActions } from '../customReduxRouter';
import { put } from 'redux-saga/effects';

function* someSuperSaga() {
 // your logic ...
 yield put(routerActions.push('/'));
}

nikakoy131 avatar Jul 24 '20 12:07 nikakoy131

See https://github.com/supasate/connected-react-router/pull/438 for a temporary fix. I am not sure it is the correct/performant way to support the new React Router v6-beta.0, but it works.

phistuck avatar Jul 28 '20 09:07 phistuck

Hello @supasate, I was wondering about the status on this issue. Would be awesome to get some updates! Also thanks for the great work! 👍

elnazabo avatar Jan 21 '21 16:01 elnazabo

Ping ping. @supasate any chance for an alpha or beta version with support for react-router@v6^?

chandlervdw avatar Mar 23 '21 20:03 chandlervdw

Same here, I'm getting tons of errors trying to implement this on react-router-dom v6.0.0-beta, like this one: Error: useLocation() may be used only in the context of a <Router> component.

oscar-gallog avatar Jul 04 '21 17:07 oscar-gallog

I installed the version on the dev branch, and now I just got this error: Module not found: Can't resolve 'connected-react-router' in 'project/src/App.tsx'

oscar-gallog avatar Jul 04 '21 18:07 oscar-gallog

react router was released to 6.0.0 version. Do you need update compatibility with react-router?

sergeushenecz avatar Nov 04 '21 16:11 sergeushenecz

Currently, connected-react-router just supports React router v4/5. I tested it, it ran with error @.@

b0yblake avatar Nov 09 '21 04:11 b0yblake

When to support React router v6?

lovewinders avatar Dec 02 '21 05:12 lovewinders

Any updated?

aviyi avatar May 29 '22 13:05 aviyi

When will we get this for v6?

schilffarth avatar Dec 29 '22 13:12 schilffarth

More than 2 years, still no update?

petro-shkuratenyuk avatar May 31 '23 00:05 petro-shkuratenyuk

I think we can consider it will never be done

Astarosa avatar Aug 24 '23 12:08 Astarosa