Skip to content

Commit

Permalink
Upgrade React to 16.8.2: Welcome React Hooks (#13992)
Browse files Browse the repository at this point in the history
* Upgrade React to 16.8.2

* Update package-lock.json file

* Expose React Hooks
  • Loading branch information
youknowriad committed Mar 6, 2019
1 parent 137a018 commit e0bf5bd
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 178 deletions.
4 changes: 2 additions & 2 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,12 +540,12 @@ function gutenberg_register_vendor_scripts() {

gutenberg_register_vendor_script(
'react',
'https://unpkg.com/react@16.6.3/umd/react' . $react_suffix . '.js',
'https://unpkg.com/react@16.8.2/umd/react' . $react_suffix . '.js',
array( 'wp-polyfill' )
);
gutenberg_register_vendor_script(
'react-dom',
'https://unpkg.com/react-dom@16.6.3/umd/react-dom' . $react_suffix . '.js',
'https://unpkg.com/react-dom@16.8.2/umd/react-dom' . $react_suffix . '.js',
array( 'react' )
);
$moment_script = SCRIPT_DEBUG ? 'moment.js' : 'min/moment.min.js';
Expand Down
200 changes: 32 additions & 168 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
"pegjs": "0.10.0",
"phpegjs": "1.0.0-beta7",
"postcss": "7.0.13",
"react-dom": "16.6.3",
"react-test-renderer": "16.6.3",
"react-dom": "16.8.2",
"react-test-renderer": "16.8.2",
"redux": "4.0.0",
"rimraf": "2.6.2",
"rtlcss": "2.4.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/element/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"@babel/runtime": "^7.3.1",
"@wordpress/escape-html": "file:../escape-html",
"lodash": "^4.17.11",
"react": "^16.6.3",
"react-dom": "^16.6.3"
"react": "^16.8.2",
"react-dom": "^16.8.2"
},
"publishConfig": {
"access": "public"
Expand Down
26 changes: 26 additions & 0 deletions packages/element/src/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ import {
Fragment,
isValidElement,
StrictMode,
useState,
useEffect,
useContext,
useReducer,
useCallback,
useMemo,
useRef,
useImperativeHandle,
useLayoutEffect,
useDebugValue,
} from 'react';
import { isString } from 'lodash';

Expand Down Expand Up @@ -93,6 +103,22 @@ export { isValidElement };

export { StrictMode };

/**
* Make React Hooks available
*/
export {
useCallback,
useContext,
useDebugValue,
useEffect,
useImperativeHandle,
useLayoutEffect,
useMemo,
useReducer,
useRef,
useState,
};

/**
* Concatenate two or more React children objects.
*
Expand Down
Loading

0 comments on commit e0bf5bd

Please sign in to comment.