2
我有一個範圍問題,我正在努力解決。React.createClass中的範圍問題
我將getTrackNotes導入到es6模塊中,並且我想根據下面的內容在React類中引用它,但是這設置爲Track(React類)。
我該如何參考?
import { getTrackNotes } from '../utils/immutableInstruments';
const Track = React.createClass({
componentDidMount() {
const { trackId } = this.props.params;
function updateTimeSequencer (socket, state, getTrackNotes, TimeSequencer, instruments, trackId)
{
//I want to call getTrackNotes here, but the scope is set to the Track React class
**getTrackNotes();**
}
var instruments = this.props.instruments;
socket.on('state', updateTimeSequencer.bind(this, socket));
}
啊,我想知道這到底是怎麼回事,我想試試謝謝 – iKode