reactjs – React wrapper:React不识别DOM元素上的`staticConte
发布时间:2020-12-15 20:46:21 所属栏目:百科 来源:网络整理
导读:我正在尝试围绕react-router-dom NavLink组件创建一个包装器组件. 我希望我的自定义组件接受所有NavLinks道具,并将它们代理到NavLink. 但是,当我这样做时,我得到: Warning: React does not recognize the `staticContext` prop on a DOM element. If you in
我正在尝试围绕react-router-dom NavLink组件创建一个包装器组件.
我希望我的自定义组件接受所有NavLinks道具,并将它们代理到NavLink. 但是,当我这样做时,我得到: Warning: React does not recognize the `staticContext` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute,spell it as lowercase `staticcontext` instead. If you accidentally passed it from a parent component,remove it from the DOM element. 可在此处找到该问题的工作演示:https://codesandbox.io/s/w0n49rw7kw 谢谢,
有一种方法可以克服使用:
const { to,staticContext,...rest } = this.props; 所以你的……休息永远不会包含staticContext (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |