Recommend a real rAF polyfill

This commit is contained in:
Dan Abramov
2017-11-06 13:24:12 +00:00
committed by GitHub
parent 13c0e48b34
commit 37da66e90f

View File

@@ -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';
```