阅读背景:

ReactJS - this.state中的数组在删除时正确更新但结果在以后的状态更改之前不会呈现?

来源:互联网 

I've seen variations of this question posted but none match my problem. I am displaying an array of text fields and want to be able to delete one of them. When the delete button next to any text field is clicked, the last item in the array disappears. However, I've checked this.state and the correct item was deleted, just the wrong one was taken from the rendered array. When I click a button that hides the text fields and then un-hide, the array is fixed and shows the correct item deleted. Why is this happening? The state is updated with what I want removed, but it seems like it renders something other than the state. I've tried using I've seen variations of this question posted bu




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: