【发布时间】:2023-01-28 03:15:59
【问题描述】:
在设置新的 React Web 应用程序项目时,在安装 react-router-dom v^6.8.0 之后,我使用从 react-router-dom 导入的 NavLink 的那一刻,如下所示:
<NavLink>
<MyCustomJsx />
</NavLink>
该应用程序会崩溃说:
Unexpected Application Error! _ref is undefined
检查控制台后:
React Router caught the following error during render TypeError: _ref is undefined,在另一个不同的第二个日志中:The above error occurred in the <Link> component: Stacktrace here
谷歌搜索一无所获,因为有太多关于 React 引用的帖子和问题,HTML 引用是未定义的,但不是关于这个下划线引用:_ref。删除 <NavLink> 可以消除错误...有什么想法吗?
【问题讨论】:
标签: react-router-dom