this is the correct link to react-router-redux v4 example. you have to use connectedrouter from react-router-redux and pass history. i configured my project yesterday based on this example and it works fine.


in react router v4, your configuration should be something like below.

 import { browserrouter, route, switch } from 'react-router-dom';

 <provider store={createstorewithmiddleware(reducers)}>
            <route path="/api/:id" component={componentone} />
            <route path="/" component={home} />

the api has been changed since the previous version. also note that the order matters. keep the most specific paths at the top.


in my project, i get rid of this type of error in two steps:

  1. step in to import import createbrowserhistory from 'history/createbrowserhistory'; and declaring const customhistory = createbrowserhistory(); like this:

    import  { browserrouter as staticrouter, router, switch, route, link } from 'react-router-dom';
    import  createbrowserhistory from 'history/createbrowserhistory';
    const   customhistory = createbrowserhistory();
  2. it looks like that it is necessary to add history attribute to the router:

    <router history={customhistory}>
        <link to={'/.../' + linkname1}>
        <link to={'/.../' + linkname2}>

Related Query

More Query from same tag