Browse Source
Merge pull request #244 from reactjs/gaearon-patch-6
Recommend a real rAF polyfill
main
Brian Vaughn
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
5 deletions
-
content/docs/reference-javascript-environment-requirements.md
|
|
@ -23,10 +23,9 @@ ReactDOM.render( |
|
|
|
); |
|
|
|
``` |
|
|
|
|
|
|
|
React also depends on `requestAnimationFrame` (even in test environments). A simple shim for testing environments would be: |
|
|
|
React also depends on `requestAnimationFrame` (even in test environments). |
|
|
|
You can use the [raf](https://www.npmjs.com/package/raf) package to shim `requestAnimationFrame`: |
|
|
|
|
|
|
|
```js |
|
|
|
global.requestAnimationFrame = function(callback) { |
|
|
|
setTimeout(callback, 0); |
|
|
|
}; |
|
|
|
``` |
|
|
|
import 'raf/polyfill'; |
|
|
|
``` |
|
|
|