Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 未捕获不变违反:最小化反应错误#152;_Html_Reactjs_Jsx - Fatal编程技术网

Html 未捕获不变违反:最小化反应错误#152;

Html 未捕获不变违反:最小化反应错误#152;,html,reactjs,jsx,Html,Reactjs,Jsx,在我的本地开发模式下,此代码运行良好: {enable && ( <Nav title={hasFlagEnabled ? 'flag enabled' : 'flag disabled'} url={identified? `${URL}` : `${URL}/xyz.htm`} target={identified? '_blank' : ''} />

在我的本地开发模式下,此代码运行良好:

 {enable && (
          <Nav
            title={hasFlagEnabled ? 'flag enabled' : 'flag disabled'}
            url={identified? `${URL}` : `${URL}/xyz.htm`}
            target={identified? '_blank' : ''}
          />
        )}

你知道为什么会这样吗?

我希望你能找到答案。最后必须
返回null
。如果
enable
为false,则代码不会返回任何内容,引用的文档也会这样说。只需在末尾添加一个
returnnull
,它就可以工作了。
react-dom.production.min.js:13 Uncaught Invariant Violation: Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=f for the full message or use the non-minified dev environment for full errors and additional helpful warnings.