https://github.com/kingback/react-polyfills
react polyfills for ref, context and hooks
https://github.com/kingback/react-polyfills
context hooks polyfill react ref
Last synced: about 1 month ago
JSON representation
react polyfills for ref, context and hooks
- Host: GitHub
- URL: https://github.com/kingback/react-polyfills
- Owner: kingback
- License: mit
- Created: 2019-09-03T08:35:43.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-15T11:52:19.000Z (almost 4 years ago)
- Last Synced: 2026-01-04T00:18:19.774Z (2 months ago)
- Topics: context, hooks, polyfill, react, ref
- Language: JavaScript
- Size: 289 KB
- Stars: 12
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-polyfills
> React/Rax polyfills for ref, context and hooks
## usage
### React
> version < v16.3
```js
import {
// memo
memo,
// ref
createRef,
forwardRef,
// Fragment
Fragment,
// PureComponent
PureComponent,
// portal
createPortal,
// context
createContext,
// hooks
withHooks,
useRef,
useState,
useContext,
useReducer,
useEffect,
useLayoutEffect,
useMemo,
useCallback,
useImperativeHandle
} from 'react-polyfill-all';
```
#### use react patch
```js
import 'react-polyfill-patch';
import {
// memo
memo,
// ref
createRef,
forwardRef,
// Fragment
Fragment,
// PureComponent
PureComponent,
// context
createContext,
// hooks
useRef,
useState,
useContext,
useReducer,
useEffect,
useLayoutEffect,
useMemo,
useCallback,
useImperativeHandle
} from 'react';
import { createPortal } from 'react-dom';
```
### Rax
> version <= 0.6.7
```js
import {
// memo
memo,
// ref
createRef,
forwardRef,
// context
createContext,
// hooks
withHooks,
useRef,
useState,
useContext,
useReducer,
useEffect,
useLayoutEffect,
useMemo,
useCallback,
useImperativeHandle
} from 'rax-polyfill-all';
```
### More information
* [react-polyfill-all](https://www.npmjs.com/package/react-polyfill-all)
* [react-polyfill-patch](https://www.npmjs.com/package/react-polyfill-patch)
* [rax-polyfill-all](https://www.npmjs.com/package/rax-polyfill-all)