Dan Abramov 7 years ago
committed by GitHub
parent
commit
94ebecdf2c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      content/blog/2018-03-29-react-v-16-3.md

2
content/blog/2018-03-29-react-v-16-3.md

@ -43,7 +43,7 @@ Generally, React components are declarative, but sometimes imperative access to
For example, if you replace a `<button>` with a custom `<FancyButton>` component, the `ref` attribute on it will start pointing at the wrapper component instead of the DOM node (and would be `null` for functional components). While this is desirable for "application-level" components like `FeedStory` or `Comment` that need to be encapsulated, it can be annoying for "leaf" components such as `FancyButton` or `MyTextInput` that are typically used like their DOM counterparts, and might need to expose their DOM nodes.
Ref forwarding is a new opt-in feature that lets some components take a `ref` they receive, and pass it further down (in other words, "forward" it) to a child. In the example below, `FancyButton` forward its ref to a DOM `button` that it renders:
Ref forwarding is a new opt-in feature that lets some components take a `ref` they receive, and pass it further down (in other words, "forward" it) to a child. In the example below, `FancyButton` forwards its ref to a DOM `button` that it renders:
`embed:16-3-release-blog-post/fancy-button-example.js`

Loading…
Cancel
Save