Added React.forwardRef to API and docs

This commit is contained in:
Brian Vaughn
2018-03-16 09:30:07 -07:00
parent a937c46e02
commit 201fcadfa7
9 changed files with 130 additions and 26 deletions

View File

@@ -0,0 +1,15 @@
import FancyButton from './FancyButton';
// highlight-next-line
const ref = React.createRef();
// The FancyButton component we imported is the LogProps HOC.
// Even though the rendered output will be the same,
// Our ref will point to LogProps instead of the inner FancyButton component!
// This means we can't call e.g. ref.current.focus()
// highlight-range{4}
<FancyButton
label="Click Me"
handleClick={handleClick}
ref={ref}
/>;