Skip to content

Commit 438a423

Browse files
committed
Merge pull request #656 from henckellbach/454-thumbs-unsafe
Fix UNSAFE_componentWillReceiveProps warning in Thumbs
2 parents 6140b26 + 0fc10b1 commit 438a423

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/components/Thumbs.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,14 @@ export default class Thumbs extends Component<Props, State> {
7070
this.setupThumbs();
7171
}
7272

73-
UNSAFE_componentWillReceiveProps(props: Props) {
74-
if (props.selectedItem !== this.state.selectedItem) {
73+
componentDidUpdate(prevProps: Props) {
74+
if (this.props.selectedItem !== this.state.selectedItem) {
7575
this.setState({
76-
selectedItem: props.selectedItem,
77-
firstItem: this.getFirstItem(props.selectedItem),
76+
selectedItem: this.props.selectedItem,
77+
firstItem: this.getFirstItem(this.props.selectedItem),
7878
});
7979
}
80-
}
8180

82-
componentDidUpdate(prevProps: Props) {
8381
if (this.props.children === prevProps.children) {
8482
return;
8583
}

0 commit comments

Comments
 (0)