diff --git a/package.json b/package.json index 409748a..0838648 100644 --- a/package.json +++ b/package.json @@ -49,4 +49,4 @@ "webpack-cli": "^2.0.10", "webpack-merge": "^4.1.2" } -} \ No newline at end of file +} diff --git a/src/provider.js b/src/provider.js index bc57ed3..4e96a74 100644 --- a/src/provider.js +++ b/src/provider.js @@ -18,7 +18,14 @@ export default class Provider extends Component { this.tabs = document.querySelectorAll('a'); this.checkMobile(); + this.handleDebouncedCheck(); + } + + componentWillUnmount() { + window.removeEventListener('resize', this.handleDebouncedCheck, true); + } + handleDebouncedCheck = () => { window.addEventListener( 'resize', debounce(() => this.checkMobile(this.props), 66)