我想调用一个函数,该函数应基于getDerivedStateFromProps()
返回的数据执行
static getDerivedStateFromProps(nextprops, prevstate) {
return {
value: nextprops.value
}
this.`sampleFunction()` // which is not possible after return statement
}
但是sampleFunction()
的执行仅基于从getDerivedStateFromProps()
返回的数据。
因此,有人可以让我知道如何实现这一目标吗?谢谢