We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 649ca20 commit ff18f61Copy full SHA for ff18f61
src/index.js
@@ -30,19 +30,23 @@ export default class ContainerDimensions extends Component {
30
callOnAdd: false
31
})
32
this.elementResizeDetector.listenTo(this.parentNode, this.onResize)
33
+ this.componentIsMounted = true
34
this.onResize()
35
}
36
37
componentWillUnmount() {
38
+ this.componentIsMounted = false
39
this.elementResizeDetector.uninstall(this.parentNode)
40
41
42
onResize() {
43
const clientRect = ContainerDimensions.getDomNodeDimensions(this.parentNode)
- this.setState({
- initiated: true,
44
- ...clientRect
45
- })
+ if (this.componentIsMounted) {
+ this.setState({
46
+ initiated: true,
47
+ ...clientRect
48
+ })
49
+ }
50
51
52
render() {
0 commit comments