[英]What does this JS snippet do? `“development” !== 'production'`
It's all over this react.js file : 这是react.js文件的全部内容 :
if ("development" !== 'production') {
var typeofSpec = typeof spec;
var isMixinValid = typeofSpec === 'object' && spec !== null;
"development" !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0;
}
When would it ever be false? 什么时候会是假的? In what way is it useful?
它以什么方式有用? Was it autogenerated?
它是自动生成的吗?
The purpose of "development" !== 'production'
is to enable development mode. "development" !== 'production'
的目的"development" !== 'production'
是启用开发模式。 The reason it is done this way is so that the block is removed from the production build during minification. 这样做的原因是在缩小过程中将块从生产构建中移除。
When building for production, "production" !== "production"
can never be true
, so the block is removed by the minifier. 在构建生产时,
"production" !== "production"
永远不会true
,因此缩小器会移除块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.