From 9948cc94e399f6597be6d40710d181dcaeb0248a Mon Sep 17 00:00:00 2001 From: Rauno Date: Mon, 2 Apr 2018 22:20:22 +0300 Subject: [PATCH 1/3] Add createRef to top level API section --- content/docs/reference-react.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/content/docs/reference-react.md b/content/docs/reference-react.md index ae0912ae..61ef8151 100644 --- a/content/docs/reference-react.md +++ b/content/docs/reference-react.md @@ -49,9 +49,10 @@ See [Using React without JSX](/docs/react-without-jsx.html) for more information - [`React.Fragment`](#reactfragment) -### Other +### Refs - [`React.forwardRef`](#reactforwardref) +- [`React.createRef`](#reactcreateref) * * * @@ -227,4 +228,9 @@ You can also use it with the shorthand `<>` syntax. For more information, see `React.forwardRef` accepts a render function that receives `props` and `ref` parameters and returns a React node. Ref forwarding is a technique for passing a [ref](/docs/refs-and-the-dom.html) through a component to one of its descendants. This technique can be particularly useful with [higher-order components](/docs/higher-order-components.html): `embed:reference-react-forward-ref.js` -For more information, see [forwarding refs](/docs/forwarding-refs.html). \ No newline at end of file +For more information, see [forwarding refs](/docs/forwarding-refs.html). + +### `React.createRef` + +`React.createRef` creates a ref that can be attached to React elements via the ref attribute. +`embed:16-3-release-blog-post/create-ref-example.js` \ No newline at end of file From 3709c8e4efbb528aabd312536b7e234da2420526 Mon Sep 17 00:00:00 2001 From: Rauno Date: Tue, 3 Apr 2018 01:32:51 +0300 Subject: [PATCH 2/3] Add link to refs-and-the-dom in description --- content/docs/reference-react.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/reference-react.md b/content/docs/reference-react.md index 61ef8151..045c1e56 100644 --- a/content/docs/reference-react.md +++ b/content/docs/reference-react.md @@ -232,5 +232,5 @@ For more information, see [forwarding refs](/docs/forwarding-refs.html). ### `React.createRef` -`React.createRef` creates a ref that can be attached to React elements via the ref attribute. +`React.createRef` creates a [ref](/docs/refs-and-the-dom.html) that can be attached to React elements via the ref attribute. `embed:16-3-release-blog-post/create-ref-example.js` \ No newline at end of file From 861544b16c1d2dfcef031cee9bb0c82157de6c5e Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Tue, 3 Apr 2018 10:16:19 -0700 Subject: [PATCH 3/3] Move createRef above forwardRef --- content/docs/reference-react.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/content/docs/reference-react.md b/content/docs/reference-react.md index 045c1e56..d6c9552c 100644 --- a/content/docs/reference-react.md +++ b/content/docs/reference-react.md @@ -51,8 +51,8 @@ See [Using React without JSX](/docs/react-without-jsx.html) for more information ### Refs -- [`React.forwardRef`](#reactforwardref) - [`React.createRef`](#reactcreateref) +- [`React.forwardRef`](#reactforwardref) * * * @@ -223,14 +223,15 @@ render() { You can also use it with the shorthand `<>` syntax. For more information, see [React v16.2.0: Improved Support for Fragments](/blog/2017/11/28/react-v16.2.0-fragment-support.html). + +### `React.createRef` + +`React.createRef` creates a [ref](/docs/refs-and-the-dom.html) that can be attached to React elements via the ref attribute. +`embed:16-3-release-blog-post/create-ref-example.js` + ### `React.forwardRef` `React.forwardRef` accepts a render function that receives `props` and `ref` parameters and returns a React node. Ref forwarding is a technique for passing a [ref](/docs/refs-and-the-dom.html) through a component to one of its descendants. This technique can be particularly useful with [higher-order components](/docs/higher-order-components.html): `embed:reference-react-forward-ref.js` For more information, see [forwarding refs](/docs/forwarding-refs.html). - -### `React.createRef` - -`React.createRef` creates a [ref](/docs/refs-and-the-dom.html) that can be attached to React elements via the ref attribute. -`embed:16-3-release-blog-post/create-ref-example.js` \ No newline at end of file