0
我的React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
創建可以在JS類中重用的方法/函數。
我想有一個類中的公共方法,因爲我想重新使用該功能在其他方法錯誤,有什麼錯我下面的代碼?
componentDidMount() {
this.getCurrentMonthData('2017-10-1', '2017-12-1');
}
getCurrentMonthData = (from, to) => {
//do something
}
OtherFunc =() => {
this.getCurrentMonthData('2017-10-1', '2017-12-1');
}
這是在類的主體或構造? –
您的渲染功能存在問題。要麼你沒有寫渲染功能,或者它沒有返回任何東西。 –