问答详情
源自:-

todoList中删除操作 onClick = {e => store.removeTodo(todo)}为什么一定要这样写?

<span onClick={ this.handleRemoveClick(todo)}>=> X</span>
handleRemoveClick = (todo)=>{
    this.props.store.removeTodo(todo)
}

会有一个这样的错误提示

Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.

这是为什么?

提问者:慕粉007羊 2019-05-27 15:54

个回答