Skip to content

Commit 6452c29

Browse files
lyubchevctrlplusb
authored andcommitted
Changed componentWillReceiveProps to componentDidUpdate (#163)
* Change componentWillReceiveProps to componentDidUpdate * Fix variable name
1 parent 0c0aa62 commit 6452c29

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/component.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ export default class SizeMe extends Component {
2626
}
2727
}
2828

29-
componentWillReceiveProps(nextProps) {
29+
componentDidUpdate(prevProps) {
3030
const {
3131
children: prevChildren,
3232
render: prevRender,
33-
...prevSizeMeConfig
33+
...currentSizeMeConfig
3434
} = this.props
3535
const {
3636
children: nextChildren,
3737
render: nextRender,
38-
...nextSizeMeConfig
39-
} = nextProps
40-
if (!isShallowEqual(prevSizeMeConfig, nextSizeMeConfig)) {
41-
this.createComponent(nextSizeMeConfig)
38+
...prevSizeMeConfig
39+
} = prevProps
40+
if (!isShallowEqual(currentSizeMeConfig, prevSizeMeConfig)) {
41+
this.createComponent(currentSizeMeConfig)
4242
}
4343
}
4444

0 commit comments

Comments
 (0)