mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-27 03:08:06 +00:00
Doc updates for React 16 + blog post (#10824)
* Doc updates for React 16 + blog post * Add link to Sophie's post
This commit is contained in:
32
docs/reference-javascript-environment-requirements.md
Normal file
32
docs/reference-javascript-environment-requirements.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
id: javascript-environment-requirements
|
||||
title: JavaScript Environment Requirements
|
||||
layout: docs
|
||||
category: Reference
|
||||
permalink: docs/javascript-environment-requirements.html
|
||||
---
|
||||
|
||||
React 16 depends on the collection types [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) and [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set). If you support older browsers and devices which may not yet provide these natively (e.g. IE < 11), consider including a global polyfill in your bundled application, such as [core-js](https://github.com/zloirock/core-js) or [babel-polyfill](https://babeljs.io/docs/usage/polyfill/).
|
||||
|
||||
A polyfilled environment for React 16 using core-js to support older browsers might look like:
|
||||
|
||||
```js
|
||||
import 'core-js/es6/map';
|
||||
import 'core-js/es6/set';
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
ReactDOM.render(
|
||||
<h1>Hello, world!</h1>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
```
|
||||
|
||||
React also depends on `requestAnimationFrame` (even in test environments). A simple shim for testing environments would be:
|
||||
|
||||
```js
|
||||
global.requestAnimationFrame = function(callback) {
|
||||
setTimeout(callback, 0);
|
||||
};
|
||||
```
|
||||
Reference in New Issue
Block a user