Skip to content

Commit

Permalink
fix : resize listener bug
Browse files Browse the repository at this point in the history
  • Loading branch information
amrelbialy committed Sep 4, 2020
1 parent 2a8ebf3 commit 6c5bd72
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ class CloudimageProvider extends Component {
}
}

componentWillUnmount() {
window.removeEventListener('resize', this.updateDimensions);
}

updateDimensions = debounce(100, () => {
this.setState({ innerWidth: window.innerWidth });
});
Expand Down

0 comments on commit 6c5bd72

Please sign in to comment.