I followed the advice in https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#gradual-migration-path and after upgrading to React 16.3.2 I wanted to rename all our soon to be deprecated lifecycle methods to their UNSAFE_
equivalents.
However I noticed that UNSAFE_componentWillReceiveProps
is not called at all. When I change it back to componentWillReceiveProps
it works. Any ideas why?
class Chart extends React.Component<ChartProps> {
chartContainer: SVGSVGElement;
tooltip: HTMLDivElement;
xScale: ScaleBand<string>;
yScale: ScaleLinear<number, number>;
UNSAFE_componentWillReceiveProps(nextProps: Props) {
...
}
...
}
I found the issue. react-dom
package needs to be upgraded to 16.3.2 version as well.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.