0
我已經創建了一個UI組件,該組件已打包到它自己的模塊中。我正在其他組件的渲染功能中實現它。除了IE9以外,這個功能非常好。在IE9中,我收到以下錯誤:React組件在Internet Explorer 9中無效
SCRIPT5022: MyCustomComponent.render(): A valid ReactComponent must be returned. You may have returned undefined, an array or some other invalid object.
app.029dee66a8362f45fef1.js?029dee66a8362f45fef1, line 11504 character 2
任何人遇到此問題?我試圖登錄MyCustomerComponent,這是無論是在Chrome和IE9的預期目標
console.log(typeof(MyCustomComponent));
console.log(MyCustomComponent);
兩個瀏覽器列表:
LOG: function
LOG: function MyCustomComponent(props) {
_classCallCheck(this, MyCustomComponent);
return _possibleConstructorReturn(this, Object.getPrototypeOf(MyCustomComponent).call(this, props));
}
這裏是我的模糊成分的樣子:
export default class MyCustomComponent extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div className={"my-class another-class"}>
<span className="my-class2"></span>
<span className="my-class2"></span>
<span className="my-class2"></span>
</div>
);
}
}
「MyCustomComponent」中的'render'方法是什麼樣的?這是渲染引起問題的返回語句。 – dannyjolie
@dannyjolie我已經用我的組件 –
的代碼更新了我的問題,看起來很奇怪。您是否導入了React,或者您是否在全球範圍內擁有它?也許它可能與此https://github.com/facebook/react/issues/5407 – dannyjolie