Connected-react-router: react-router-redux is deprecated

Created on 7 Jun 2018  路  13Comments  路  Source: supasate/connected-react-router

Hi @supasate !

now when react-router-redux is deprecated you proably would be the best alternative
https://github.com/ReactTraining/react-router/commit/b1a77bceaf972dddb557b7ddd52131df91e15d14

the main concern about this project - it was not updated for a long time. please tell us about your plans? is this project still alive? can we expect updates?

PS and if yes, it would be good to have SSR because its the only thing missinng from RRR functionality

Most helpful comment

Was fairly straight forward - only significant change was passing history to connectRouter().

Steps: (original code is commented out)

yarn add connected-react-router

// import { routerMiddleware } from 'react-router-redux';
import { routerMiddleware } from 'connected-react-router';

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

// import { ConnectedRouter } from 'react-router-redux';
import { ConnectedRouter } from 'connected-react-router';

// import { routerReducer as routing } from 'react-router-redux';
import { connectRouter } from 'connected-react-router';

const combinedReducers = persistCombineReducers(persistConfig, {
  ...baseReducers,
  ...customReducers,
  form,
  orm,
  // routing,
  router: connectRouter(history),
});

yarn remove react-router-redux

All 13 comments

The world now lacks any maintained solution for binding the router to redux? Angular has one via ngrx despite the react community popularizing the redux pattern, surprising it fell behind.

I'll be back to start maintaining it again. But, my time is quite limited, so, if anyone is interested to help maintain the project, please let me know!

I鈥檓 not very experience on maintaining an GitHub project, but I would be very glad helping somehow!

@brneto Thanks! Can you connect with me via my public email?

hi @supasate I can help a bit too

@supasate is there any plans to add Readme section about migrating from react-router-redux?

@supasate good to hear
I'd like to help as I can

It would be good to make a realease soon, so these are my thoughts on what should be done (read: people want to see)

  • [ ] bump, check and fix peer deps for redux 4 (redux, react-redux, redux-devtools, redux-devtools-extension)'

  • [ ] fix SSR, use MemoryHistory or HashHistory (history, react-router-dom)

for example simple hack will work

import {createBrowserHistory, createMemoryHistory} from "history";

const canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);

export default canUseDOM ? createBrowserHistory() : createMemoryHistory();
  • [ ] add some migration guide to readme

For the next major update

  • [ ] think about smoth migration from RRR by changing API to what it was in RRR. this is kinda tricky but rematch users already complaining

also idk what to do if I want to connect router to my custom component?
should i do something like this?

const App = ({ history }) => {
  return (
    <MyCustomConnectedRouter history={history}>
      <ConnectedRouter history={history}>
        { routes }
      </ConnectedRouter>
    </MyCustomConnectedRouter>
  )
}

Hi there, I would also be willing to help with merging PRs

Do you plan to release a migrating guide? react-router-redux -> connected-react-router

Do you plan to release a migrating guide? react-router-redux -> connected-react-router

I have a fairly complicated setup - I'm going through the conversion today - I use redux-persist and redux-saga as well.

I'll document the code I have to change - it might be a good base to start something from.

Was fairly straight forward - only significant change was passing history to connectRouter().

Steps: (original code is commented out)

yarn add connected-react-router

// import { routerMiddleware } from 'react-router-redux';
import { routerMiddleware } from 'connected-react-router';

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

// import { ConnectedRouter } from 'react-router-redux';
import { ConnectedRouter } from 'connected-react-router';

// import { routerReducer as routing } from 'react-router-redux';
import { connectRouter } from 'connected-react-router';

const combinedReducers = persistCombineReducers(persistConfig, {
  ...baseReducers,
  ...customReducers,
  form,
  orm,
  // routing,
  router: connectRouter(history),
});

yarn remove react-router-redux

@jmcpeak Where does the history argument come from?

@ralphicus you need to add these two lines in that file
import { createBrowserHistory } from 'history'
const history = createBrowserHistory()

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bmueller-sykes picture bmueller-sykes  路  4Comments

dcs3spp picture dcs3spp  路  3Comments

BerndWessels picture BerndWessels  路  3Comments

preciselywilliam picture preciselywilliam  路  4Comments

hauptrolle picture hauptrolle  路  3Comments