README.md 1.21 KB
Newer Older
1
2
3
# react-app-polyfill

This package includes polyfills for various browsers.
Joe Haddad's avatar
Joe Haddad committed
4
It includes minimum requirements and commonly used language features used by [Create React App](https://github.com/facebook/create-react-app) projects.
5
6
7
8
9
10
11
12
13
14
15

### Features

Each polyfill ensures the following language features are present:

1. `Promise` (for `async` / `await` support)
1. `window.fetch` (a Promise-based way to make web requests in the browser)
1. `Object.assign` (a helper required for Object Spread, i.e. `{ ...a, ...b }`)
1. `Symbol` (a built-in object used by `for...of` syntax and friends)
1. `Array.from` (a built-in static method used by array spread, i.e. `[...arr]`)

Joe Haddad's avatar
Joe Haddad committed
16
17
18
19
20
### Usage

First, install the package using Yarn or npm:

```bash
Dan Abramov's avatar
Dan Abramov committed
21
22
23
24
25
26
27
npm install react-app-polyfill
```

or

```bash
yarn add react-app-polyfill
Joe Haddad's avatar
Joe Haddad committed
28
```
29

Joe Haddad's avatar
Joe Haddad committed
30
Now, you can import the entry point for the minimal version you intend to support. For example, if you import the IE9 entry point, this will include IE10 and IE11 support.
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

#### Internet Explorer 9

```js
// This must be the first line in src/index.js
import 'react-app-polyfill/ie9';

// ...
```

#### Internet Explorer 11

```js
// This must be the first line in src/index.js
import 'react-app-polyfill/ie11';

// ...
```