Closed wuz closed 5 years ago
React already throttles calls to setState, which is the only thing in the resize function currently - however it might be more clear/worthwhile in the future to throttle this function:
componentDidMount() { window.addEventListener('resize', () => { this.setState({ width: BreakpointUtil.currentWidth, currentBreakpoint: BreakpointUtil.currentBreakpointName }); }); }
Cool library! Definitely look forward to trying it out on a project!
@wuz We definitely need this. Feel free to create a PR if you this mind mapped already.
PR #9 adds code to throttle resize event.
resize
React already throttles calls to setState, which is the only thing in the resize function currently - however it might be more clear/worthwhile in the future to throttle this function:
Cool library! Definitely look forward to trying it out on a project!