最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Does React use requestAnimationFrame? If so, how does it use it? - Stack Overflow

programmeradmin1浏览0评论

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?

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?

Share Improve this question edited May 23, 2017 at 11:52 CommunityBot 11 silver badge asked Jan 25, 2014 at 15:41 Sebastien LorberSebastien Lorber 92.1k73 gold badges298 silver badges428 bronze badges 5
  • Do you need a motivation to use React? – Pavlo Commented 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. – Sebastien Lorber Commented 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. – Frank van Puffelen Commented 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 Commented 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 Commented Jan 26, 2014 at 15:13
Add a comment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论