我有一个React应用程序,在IE11中的dev控制台中输出了以下错误:
警告:在此浏览器中无法识别标记
<main>。如果您打算呈现一个React组件,请用大写字母开头它的名称。
我相信这是因为<main>元素是not supported by Internet Explorer。
乍一看,我看不出应用程序有什么问题。它似乎正确地呈现,所以这更多的是为了让我安心,但是有什么方法可以强迫IE识别标签(可能是用html5垫片或其他方法),这样控制台错误就消失了吗?
发布于 2019-03-06 03:10:06
尝试挂起console.error并过滤这条消息,方法是将其放在某个位置,然后再加载动画:
const realError = console.error;
console.error = (...x) => {
// debugger;
if (x[0] === 'Warning: The tag <g> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.') {
return;
}
realError(...x);
};更多细节,请查看this thread。
https://stackoverflow.com/questions/55010078
复制相似问题