mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Explain why you need forwardRef
This commit is contained in:
@@ -105,6 +105,8 @@ Accessing values from context in lifecycle methods is a relatively common use ca
|
||||
|
||||
## Forwarding Refs to Context Consumers
|
||||
|
||||
One issue with the render prop API is that refs don't automatically get passed to wrapped elements. To get around this, use `React.forwardRef`:
|
||||
|
||||
**fancy-button.js**
|
||||
`embed:context/forwarding-refs-fancy-button.js`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user