What's new in React
2021-09-27 · 柯庆荣 · 4 分钟阅读 What's new in React
- React Next
- React 18: Concurrent Mode
- Automatic batching
- new Root API:
ReactDOM.createRoot()
- new Suspense
- Suspense on the server: Streaming Server Rendering
<Suspense>
for Data Fetching
<SuspenseList>
useTransition()
useDeferredValue()
useId()
useSyncExternalStore()
useInsertionEffect()
- React v17.0
- changes to event delegation
- new JSX transform
- React v16.9
- programmatic Profiler API
<React.Profiler>
- rename unsafe lifecycle methods
componentWillMount
componentWillReceiveProps
componentWillUpdate
- deprecate
javascript: URLs
- deprecate Factory Components
- React v16.8: Hooks
useState()
, useReducer()
useEffect()
, useLayoutEffect()
useMemo()
, useCallback()
useRef()
, useImperativeHandle()
useContext()
- React v16.7: Bug fixes
- React v16.6
React.memo()
React.lazy()
<Suspense>
for Code Splitting
static contextType
static getDerivedStateFromError()
- React v16.5: React Profiler for DevTools
- React v16.4: Pointer Events
- React v16.3
- new lifecycles
static getDerivedStateFromProps
getSnapshotBeforeUpdate
- introduce aliases for the unsafe lifecycles
UNSAFE_componentWillMount
UNSAFE_componentWillReceiveProps
UNSAFE_componentWillUpdate
- new Context API
React.createContext()
Context.Provider
/Context.Consumer
- Forwarding Refs
React.createRef()
React.forwardRef()
- Strict Mode
<StrictMode>
- React v16.2
- JSX Fragment Syntax
<Fragment>
or <></>
- React v16.0
- new core architecture: Fiber
- new render return types: arrays and strings
- Error Boundaries:
componentDidCatch()
- Portals:
React.ceatePortal()
- custom DOM attributes
- React v15.5
React.PropTypes
to prop-types
package
React.createClass
to create-react-class
package
- discontinue support for React Addons
- React v15.4
- separate React and React DOM
- React v15.0
React.createClass
to ES6 classes
- deprecate Mixins
- improve SVG support
- React v0.14
- two packages: React and React DOM
React.render()
to ReactDOM.render()
- DOM node refs
- stateless function components
- deprecate
react-tools
and JSXTransformer.js
- React v0.13
See Also