React-Bootstrap:手动调用 React.PropTypes 验证函数
在 2 周后回到项目升级我的项目后,我收到了很多无法摆脱的警告:
After upgrading my project after coming back to it after 2 weeks I receive lots of warning I can't get rid of:
warning.js:44 警告:您正在为 NavbarToggle
上的 onClick
道具手动调用 React.PropTypes 验证函数.这已被弃用,在下一个主要版本中将无法使用.由于第三方 PropTypes 库,您可能会看到此警告.
warning.js:44 Warning: You are manually calling a React.PropTypes validation function for the
onClick
prop onNavbarToggle
. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library.
warning.js:44 警告:您正在为 NavItem
上的 onClick
道具手动调用 React.PropTypes 验证函数.这已被弃用,在下一个主要版本中将无法使用.由于第三方 PropTypes 库,您可能会看到此警告.
warning.js:44 Warning: You are manually calling a React.PropTypes validation function for the onClick
prop on NavItem
. This is deprecated and will not work in the next major version. You may be seeing this warning due to a third-party PropTypes library.
显然,它们与react-bootstrap有关.
我发现了一个类似的问题 用于 react-native ,其中的答案建议升级依赖库版本.我已经这样做了,但没有任何帮助...我还完全删除了 node_modules,然后重新安装.
I have found a similar question for react-native where the answers suggest to upgrade dependent libraries versions. I have done so but it didn't no help... I also removed node_modules completely and then reinstalled again.
我查看了 github 上的问题 但没有类似的问题.
I have looked into the issues on github but there ain't a similar one.
如何更正我的应用并消除警告?
How can I correct my app and dismiss the warnings?
我拥有的版本:
- react@15.3.0
- react-bootstrap@0.30.2
我创建了这个 fiddle 用于你:
I created this fiddle for you:
var Hello = React.createClass({
render: function() {
return <div><NavItem /></div>;
}
});
ReactDOM.render(
<Hello name="World" />,
document.getElementById('container')
);
一般来说,您最好尝试将其作为问题的一部分;-)
In general, it’s best that you try to do this as part of the question ;-)
我无法重现那个小提琴中的警告.如果您使用触发此警告的 React Bootstrap 复制并粘贴代码,我很乐意再看一看.
I can’t reproduce the warning in that fiddle. If you copy and paste the code using React Bootstrap that triggers this warning, I’ll be happy to take another look.