程序员每日英语
In Strict Mode, React will call your component function twice in order to help you find accidental impurities. This is development-only behavior and does not affect production. Each ref object will be created twice, but one of the versions will be discarded. If your component function is pure (as it should be), this should not affect the behavior.
在严格模式下,react回调用你的组件2次,为了帮助你找到没有预料的错误(瑕疵),这个行为只在开发模式存在,而且不会影响生产,每个ref对象将会被创建2次,其中一个版本会被废弃,如果你的组件函数是纯函数(它应该是纯函数),这种行为不会对组件的行为造成任何影响。
impurities:n.杂质(impurity 的复数)
discarded: adj.丢弃的;废弃的
最后一句话好难翻译啊 !!!
In Strict Mode, React will call your component function twice in order to help you find accidental impurities. This is development-only behavior and does not affect production. Each ref object will be created twice, but one of the versions will be discarded. If your component function is pure (as it should be), this should not affect the behavior.
在严格模式下,react回调用你的组件2次,为了帮助你找到没有预料的错误(瑕疵),这个行为只在开发模式存在,而且不会影响生产,每个ref对象将会被创建2次,其中一个版本会被废弃,如果你的组件函数是纯函数(它应该是纯函数),这种行为不会对组件的行为造成任何影响。
impurities:n.杂质(impurity 的复数)
discarded: adj.丢弃的;废弃的
最后一句话好难翻译啊 !!!
展开
1
点赞