它遍布react.js file:
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;
}
什么时候会出错?它以什么方式有用?它是自动生成的吗?
答案 0 :(得分:2)
"development" !== 'production'
的目的是启用开发模式。之所以这样做,是为了在缩小过程中将块从生产版本中删除。
为生产而建造时,"production" !== "production"
永远不会是true
,因此,缩小器会删除该块。