【发布时间】:2020-04-24 08:56:04
【问题描述】:
所以我使用 set state 来更新我状态中的变量,并且在我想使用它之后的行中,但是它不使用新更新的状态,而是使用它之前的状态。
this.setState({filter: {startDate : new Date(new Date().setDate(new Date().getDate() - days))}})
this.props.fetchGraphEvents(this.props.currentUser, this.props.homeInfo, this.state)
在第二行this.state我想用之前刚刚更新了一行的新状态但是不行。
您会推荐任何 NPM 包或开源代码吗?
【问题讨论】:
标签: react-native state jsx