Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onResize = () => {
const { loop } = this.state;
if (window.matchMedia(`(max-width: ${breakpoints.md.width})`).matches) {
if (loop) {
this.setState({
loop: false,
});
}
} else {
if (!loop) {
this.setState({
loop: true,
});
}
}
};