25

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?

5
  • Do you need a motivation to use React?
    – Pavlo
    Jan 25, 2014 at 15:47
  • @Pavlo no I'm already using it and try to understand it better or at least be able to use it correctly. Jan 25, 2014 at 15:48
  • A quick search on github finds no (relevant) references: github.com/facebook/react/… There are more references to setTimeout and setInterval. Jan 25, 2014 at 17:05
  • Pete Hunt talked about requestAnimationFrame in an interview in August 2013. The recording and transcript are available: javascriptjabber.com/…
    – Ross Allen
    Jan 25, 2014 at 17:52
  • It is used to check for changes in the virtual DOM and update the DOM when necessary. This question isn't really suitable for SO. I would recommend to ask this question on Quora instead.
    – mekwall
    Jan 26, 2014 at 15:13

1 Answer 1

20

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.

3

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.