From 37da66e90fba5e3f28512e4eacfa61b678dafd0c Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Mon, 6 Nov 2017 13:24:12 +0000 Subject: [PATCH] Recommend a real rAF polyfill --- .../reference-javascript-environment-requirements.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/content/docs/reference-javascript-environment-requirements.md b/content/docs/reference-javascript-environment-requirements.md index 39826642..65a58da8 100644 --- a/content/docs/reference-javascript-environment-requirements.md +++ b/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); -}; -``` \ No newline at end of file +import 'raf/polyfill'; +```