Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to RRv6? #397

Open
Brodzko opened this issue Mar 2, 2020 · 16 comments
Open

Upgrade to RRv6? #397

Brodzko opened this issue Mar 2, 2020 · 16 comments

Comments

@Brodzko
Copy link

Brodzko commented Mar 2, 2020

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.

@supasate
Copy link
Owner

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 remix-run/react-router#7195.

@lukasluecke
Copy link

@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 🙂

@stephenkao
Copy link

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.

@nikakoy131
Copy link

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('/'));
}

@phistuck
Copy link

phistuck commented Jul 28, 2020

See #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.

@elnazabo
Copy link

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

@chandlervdw
Copy link

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

@oscar-gallog
Copy link

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
Copy link

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'

@sergeushenecz
Copy link

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

@b0yblake
Copy link

b0yblake commented Nov 9, 2021

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

@lovewinders
Copy link

When to support React router v6?

@aviyi
Copy link

aviyi commented May 29, 2022

Any updated?

@schilffarth
Copy link

When will we get this for v6?

@petro-shkuratenyuk
Copy link

More than 2 years, still no update?

@Astarosa
Copy link

I think we can consider it will never be done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests