From 68ef5e7c9d36d19b00cb62e8e6d394d7500bf734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Thu, 14 Mar 2019 10:35:52 +0100 Subject: [PATCH] Add docs for React hooks (#14425) --- packages/element/README.md | 40 +++++++++++++++++------ packages/element/src/react.js | 60 +++++++++++++++++++++++++++-------- 2 files changed, 77 insertions(+), 23 deletions(-) diff --git a/packages/element/README.md b/packages/element/README.md index c39eb933ec8b9..1985045799bea 100755 --- a/packages/element/README.md +++ b/packages/element/README.md @@ -318,61 +318,81 @@ Removes any mounted element from the target DOM node. [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- ### useContext [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- ### useDebugValue [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- ### useEffect [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- ### useImperativeHandle [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- ### useLayoutEffect [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- ### useMemo [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- ### useReducer [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- ### useRef [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- ### useState [src/index.js#L1-L1](src/index.js#L1-L1) -Make React Hooks available +**Related** + +- diff --git a/packages/element/src/react.js b/packages/element/src/react.js index a2fbd1cda3671..b4b9ef4146533 100644 --- a/packages/element/src/react.js +++ b/packages/element/src/react.js @@ -110,20 +110,54 @@ export { isValidElement }; export { StrictMode }; /** - * Make React Hooks available + * @see https://reactjs.org/docs/hooks-reference.html#usecallback */ -export { - useCallback, - useContext, - useDebugValue, - useEffect, - useImperativeHandle, - useLayoutEffect, - useMemo, - useReducer, - useRef, - useState, -}; +export { useCallback }; + +/** + * @see https://reactjs.org/docs/hooks-reference.html#usecontext + */ +export { useContext }; + +/** + * @see https://reactjs.org/docs/hooks-reference.html#usedebugvalue + */ +export { useDebugValue }; + +/** + * @see https://reactjs.org/docs/hooks-reference.html#useeffect + */ +export { useEffect }; + +/** + * @see https://reactjs.org/docs/hooks-reference.html#useimperativehandle + */ +export { useImperativeHandle }; + +/** + * @see https://reactjs.org/docs/hooks-reference.html#uselayouteffect + */ +export { useLayoutEffect }; + +/** + * @see https://reactjs.org/docs/hooks-reference.html#usememo + */ +export { useMemo }; + +/** + * @see https://reactjs.org/docs/hooks-reference.html#usereducer + */ +export { useReducer }; + +/** + * @see https://reactjs.org/docs/hooks-reference.html#useref + */ +export { useRef }; + +/** + * @see https://reactjs.org/docs/hooks-reference.html#usestate + */ +export { useState }; /** * Concatenate two or more React children objects.