我componentWillReceiveProps在我的应用程序中的很多地方都在使用它。现在,我必须用getDerivedStateFromProps()or替换它们componentDidUpdate()。首先,我想使用getDerivedStateFromPropsas it s 替代componentWillReceivePropsasSuggested react-nativedocs。但是有些人强烈建议不要使用这种方法,而是建议使用componentDidUpdate. 但是对于我的要求,所有新道具都必须使用state之前的渲染进行设置。getDerivedStateFromProps是最好的地方。
因此,在getDerivedStateFromProps和之间使用哪一个componentDidUpdate?