简体   繁体   English

react-router-bootstrap LinkContainer 组件因 TypeError (0 , _reactRouterDom.withRouter) is not a function 而失败

[英]react-router-bootstrap LinkContainer component fails with a TypeError (0 , _reactRouterDom.withRouter) is not a function


I have been using the **LinkContainer** from the **react-router-bootstrap** react library for a while but currently it is throwing this error when I import it: 我一直在使用 **react-router-bootstrap** react 库中的 *​​LinkContainer** 一段时间,但目前它在导入时抛出此错误:

TypeError (0 , _reactRouterDom.withRouter) is not a function TypeError (0 , _reactRouterDom.withRouter) 不是函数

I have my very simple react application in this codesandbox over here我有很简单的在这个反应应用codesandbox这里

Help me debug this please.请帮我调试这个。

You have to options, either you downgrade your version (to v5.3.0) of react-router-dom so method withRouter will be available again (used by react-router-bootstrap) or you dismiss react-router-bootstrap and use the useNavigate Hook:您必须选择,要么将 react-router-dom 的版本降级(到 v5.3.0),以便 withRouter 方法将再次可用(由 react-router-bootstrap 使用),要么关闭 react-router-bootstrap 并使用 useNavigate钩:

const navigate = useNavigate();
...
<Nav.Link onClick={() => navigate('configuration')}>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 反应路由器引导链接容器 - react-router-bootstrap linkcontainer 是否有针对 react-router-bootstrap 错误的 LinkContainer 组件的解决方案? - Is there a solution for LinkContainer component from react-router-bootstrap error? react-router-bootstrap LinkContainer 在点击时不重定向/刷新 - react-router-bootstrap LinkContainer not redirecting/refreshing on click react-router-bootstrap - 警告:函数作为 React 子项无效 - react-router-bootstrap - Warning: Functions are not valid as a React child React-bootstrap-Router LinkContainer不会在任何地方路由 - React-bootstrap-router LinkContainer doesn't route anywhere React Router - 即使不匹配也会呈现的 withRouter 组件 - React Router - withRouter component that renders even if no match TypeError: (0 , _reactRouterDom.useParams) 不是函数 - TypeError: (0 , _reactRouterDom.useParams) is not a function React-Bootstrap / React-Router-Bootstrap中NavBar品牌的最佳实践 - Best Practices for NavBar Branding in React-Bootstrap / React-Router-Bootstrap Uncaught TypeError: (0 , _reactRouter.withRouter) 在 react-router 2.4.0 中以编程方式导航到路由时不是函数 - Uncaught TypeError: (0 , _reactRouter.withRouter) is not a function when navigating to route programmatically in react-router 2.4.0 将道具传递给包装在 withRouter() 函数中的反应组件 - Passing props to a react component wrapped in withRouter() function
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM