Created
August 1, 2016 19:56
-
-
Save thomasboyt/7263cecb464231133771997a60b5c1f0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SixtyFps = React.createClass({ | |
componentDidMount() { | |
this.rafCb = this.renderLoop; | |
window.requestAnimationFrame(this._rafCb); | |
}, | |
componentWillUnmount() { | |
this.rafCb = () => {}; | |
}, | |
renderLoop() { | |
this.forceUpdate(); | |
window.requestAnimationFrame(this._rafCb); | |
}, | |
render() { | |
return this.props.children; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment