Skip to content

kingback/react-polyfills

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-polyfills

React/Rax polyfills for ref, context and hooks

usage

React

version < v16.3

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

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

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