Skip to content

Commit

Permalink
Added Drawbacks and Alternatives sections
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Mar 7, 2018
1 parent d2d71b7 commit 8132f46
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions text/0000-ref-forwarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,15 @@ Coming soon...

# Drawbacks

Coming soon...
This API increases the surface area of React slightly, and may complicate compatibility efforts for react-like frameworks (e.g. `preact-compat`). I believe this is worth the benefit of having a standardized, transparent way to forward refs.

# Alternatives

Coming soon...
Add a new class method, e.g. `getPublicInstance` or `getWrappedInstance` that coudl be used to get the inner ref. (Drawbacks listed [here](https://github.com/facebook/react/issues/4213#issuecomment-115019321).)

Specify a ["high-level" flag on the component](https://github.com/facebook/react/issues/4213#issuecomment-115048260) that instructs React to forward refs past it.

[Automatically forward refs for stateless functions components](https://github.com/facebook/react/issues/4213#issuecomment-115051991). (React currently warns if you try attaching a `ref` to a functional component, since there is no backing instance to reference.) I don't believe this approach would be sufficient, since wrapper components often require class lifecycles.

# Adoption strategy

Expand Down

0 comments on commit 8132f46

Please sign in to comment.