Files
react.dev/content/docs/reference-javascript-environment-requirements.md
Niklas Mollenhauer e12c973cf1 Update core-js includes (#2007)
The path seem to have changed in the latest `core-js` package. https://github.com/zloirock/core-js/tree/master/packages/core-js
2019-05-18 14:27:44 +03:00

1.2 KiB

id, title, layout, category, permalink
id title layout category permalink
javascript-environment-requirements JavaScript Environment Requirements docs Reference docs/javascript-environment-requirements.html

React 16 depends on the collection types Map and Set. If you support older browsers and devices which may not yet provide these natively (e.g. IE < 11) or which have non-compliant implementations (e.g. IE 11), consider including a global polyfill in your bundled application, such as core-js or babel-polyfill.

A polyfilled environment for React 16 using core-js to support older browsers might look like:

import 'core-js/es/map';
import 'core-js/es/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).
You can use the raf package to shim requestAnimationFrame:

import 'raf/polyfill';