如何以编程方式知道getDerivedStateFromProps()已返回状态?

时间:2020-08-13 10:42:37

标签: react-native getderivedstatefromprops

我想调用一个函数,该函数应基于getDerivedStateFromProps()返回的数据执行

static getDerivedStateFromProps(nextprops, prevstate) {
    return {
      value: nextprops.value
   }

   this.`sampleFunction()`   // which is not possible after return statement
}

但是sampleFunction()的执行仅基于从getDerivedStateFromProps()返回的数据。

因此,有人可以让我知道如何实现这一目标吗?谢谢

0 个答案:

没有答案