Я хотел бы вызвать метод updateCurrentThread OnClick, но я получаю следующее сообщение об ошибке:Реагировать вызов метод компонента из вложенной функции в визуализации метод
Uncaught TypeError: Cannot read property 'updateCurrentThread' of undefined
updateCurrentThread: function(thread) {
this.setState({
currentThread: thread
}).bind(this);
},
render: function() {
var threads = this.state.data.map(function (thread) {
var boundClick = this.updateCurrentThread.bind(this, i);
let time = getThreadDate(thread.timestamp);
return (
<div className="row thread" key={thread.threadID}>
<ThreadParticipants onClick={boundClick} key={i} className="small-2 small-centered columns" ids={thread.participantIDs}/>
</div>
);
})
Это относится к области функций функции, которая является первым параметром 'map'. Используйте 'thread => {}' вместо 'function() {}' – walkerrandophsmith
Заглядывая в него ... :) – walkerrandophsmith
Вот мой весь файл реакции: http://pastebin.com/Qs1uGiRk – wklm