I've found a lot of libraries for things like Media Queries, Element Queries, and Animations. At the end of the day however I found myself just writing a requestAnimationFrame loop inside my component and updating state.
react-sentinel Abstracts away rAF, and uses render props to allow you to easily tap into it by passing in a monitor function that works similarly to react-redux connect's mapStateToProps. It automatically does a shallow comparison and only updates if the returned props are different.
You can also set the priority to low, and if your browser supports it, it will use requestIdleCallback instead.
I've found a lot of libraries for things like Media Queries, Element Queries, and Animations. At the end of the day however I found myself just writing a requestAnimationFrame loop inside my component and updating state.
react-sentinel
Abstracts away rAF, and uses render props to allow you to easily tap into it by passing in a monitor function that works similarly to react-redux connect'smapStateToProps
. It automatically does a shallow comparison and only updates if the returned props are different.You can also set the priority to low, and if your browser supports it, it will use
requestIdleCallback
instead.Thanks!