0
當我寫了下面的代碼在陣營
import React,{Component} from 'react';
import ReactDOM from 'react-dom';
import './index.css';
class Date extends React.Component{
dataToString = (d) =>{
return [
d.getFullYear(),
d.getMonth + 1,
d.getDate()
].join('-')
}
錯誤,如下圖所示,該日期的方法問謝謝大家。
Uncaught TypeError: d.getFullYear is not a function
at Date._this.dataToString (index.js:10)
at Date.render (index.js:18)
at ReactCompositeComponent.js:796
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at
在線,謝謝
非常感謝,我的錯誤ID日期,我應該用戶DateClass
class DateClass extends React.Component { – suwu150