我試圖打電話等功能於React.createClass功能,但它並不適用於某些原因,我越來越Cannot read property 'test' of undefined
調用等功能於React.createClass
var WallFeed = React.createClass({
test:() => {
console.log('hello world');
},
componentDidMount:() => {
this.test();
},
render:() => {
return (
<div>test</div>
);
}
});
現在,我怎麼能從componentDidMount(React的內置函數)調用this.test()?
謝謝!
你爲什麼不使用如說是消除對React.createClass支持發展反應的反應社會ES6類? –