Does React use requestAnimationFrame? If so, how does it use it?

Sebastien Lorber picture Sebastien Lorber · Jan 25, 2014 · Viewed 8.6k times · Source

I found 2 sources where it kind of says that React is using requestAnimationFrame On this blog post about Om, a ClojureScript framework on top of React. Also on the comments of this SO answer.

I'm not sure it's part of React or if people are using it with React.

Can someone tell me what how requestAnimationFrame is used in React if it is? Or how it can be used with React and why I would choose to use it with React?

Answer

Paul O'Shannessy picture Paul O'Shannessy · Jan 28, 2014

React doesn't currently use requestAnimationFrame to do DOM updates (as we call it, the "batching strategy"). The batching strategy is injectible though so it's possible to use something else. Om makes use of that possibility and uses requestAnimationFrame to batch DOM updates.