From 0bf0e12fc1b1e6e4a400029034935f605684b465 Mon Sep 17 00:00:00 2001 From: Max Donchenko Date: Fri, 26 May 2017 14:37:35 +0300 Subject: [PATCH] Fix typo (#9786) --- docs/refs-and-the-dom.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/refs-and-the-dom.md b/docs/refs-and-the-dom.md index 8b86332e..b6c91996 100644 --- a/docs/refs-and-the-dom.md +++ b/docs/refs-and-the-dom.md @@ -149,7 +149,7 @@ function CustomTextInput(props) { In rare cases, you might want to have access to a child's DOM node from a parent component. This is generally not recommended because it breaks component encapsulation, but it can occasionally be useful for triggering focus or measuring the size or position of a child DOM node. -While you could [add a ref to to the child component](#adding-a-ref-to-a-class-component), this is not an ideal solution, as you would only get a component instance rather than a DOM node. Additionally, this wouldn't work with functional components. +While you could [add a ref to the child component](#adding-a-ref-to-a-class-component), this is not an ideal solution, as you would only get a component instance rather than a DOM node. Additionally, this wouldn't work with functional components. Instead, in such cases we recommend exposing a special prop on the child. The child would take a function prop with an arbitrary name (e.g. `inputRef`) and attach it to the DOM node as a `ref` attribute. This lets the parent pass its ref callback to the child's DOM node through the component in the middle.