Search code examples
reactjsnpmreduxreact-routerconnected-react-router

How to fix import error called by connected-react-router module?


I'm confused by issue caused by react-router-dom. It can't import matchPath function from react-router. Exception is:

./node_modules/connected-react-router/esm/selectors.js Attempted import error: 'matchPath' is not exported from 'react-router'.


Solution

  • matchPath was added to react-router sometime after V3.2.1 and before V4.3.1. Check which version you have with:

    npm list react-router
    

    If it's an older (v3) than update it with:

    npm update react-router