0
在我的組件定義的反應,我追加的事件監聽像這樣:上的onClick調用功能的陣營
/* events.js */
export function mouseyDown(event) {
console.log(event.target);
}
/* main.js */
import mouseyDown from '../controllers/events.js';
const Topbar = React.createClass ({
callMouseyDown : function(event) {
console.log(event.target);
mouseyDown(); // actually need to pass event to this method too
},
render : function() {
return (
<div className="tbIcon" data-action="shareSocial" onClick={ this.callMouseyDown}>G</div>
)}
});
然而,反應是給我一個_EventController2.default is not a function
錯誤。 我在做什麼錯?
謝謝,這似乎沒有工作。我沒有錯,什麼都沒有。爲了清楚起見,我重新命名了onClick函數。 – Kayote
@Kayote看到我的更新 – madox2
你是最高階的天才。謝謝。 – Kayote