0
我傳遞一個組件到一個嵌套組件一個onClick
方法修改該父組件的狀態。的onclick反應觸發器當部件安裝
不知怎的,當組件(不知道這是父母或子女)被安裝在被調用的方法。而現在,我得到了以下錯誤消息:
Uncaught Error: Invariant Violation: setState(...): Cannot update during an existing state transition (such as within
render
). Render methods should be a pure function of props and state.invariant
傳遞孩子的代碼如下所示
var playlists = this.props.data.map(function(playlist) {
return (
<PlaylistItem key={playlist.id}
data={playlist}
showPlaylistCode={this.getPlaylistCodeData}
/>
);
}.bind(this));
看起來很好。別的東西正在破碎。我們需要看到更多的代碼。 –
@UAvalos我不確定顯示哪部分代碼,因爲我不知道什麼是相關的 – Angela
@UAvalos因爲我不確定,所以我把它們全部放在這裏https://gist.github.com/angelathewebdev/ 31a5e441a3a152dea019 – Angela