Invariant failed: You should not use outside a

后端 未结 20 1395
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 20:55

I use react-router-dom for routing in my React application. Part of my app extracted in another package. List of dependencies looks like this:

20条回答
  •  隐瞒了意图╮
    2020-12-03 21:24

    I got this during testing my component which linked to the project (using npm link) and because of that react-router-dom loaded more than once, following solution works in my case:

    Inside webpack.config.js I added:

    resolve: {
        alias: {        
            'react-router-dom': path.resolve('./node_modules/react-router-dom')
        }
    }
    

提交回复
热议问题