React deprecates componentWillReceiveProps in favor of getDerivedStateFromProps. Documentation. If we don’t fix this, the component will be broken in React 17.
|
componentWillReceiveProps(nextProps) { |
|
if (nextProps.src !== this.props.src) { |
|
this.isLoaded = false; |
|
if (nextProps.initialImage) { |
|
this.handleInitialTimeout(); |
|
} |
|
this.setDisplayImage({ image: nextProps.src, fallbacks: nextProps.fallbackImage }); |
|
} |
|
} |
React deprecates
componentWillReceivePropsin favor ofgetDerivedStateFromProps. Documentation. If we don’t fix this, the component will be broken in React 17.react-image-fallback/src/index.js
Lines 39 to 47 in 6adce1a