forwardRef
See original GitHub issueBug report
It seems I can’t set a ref anymore on <Form />
components.
I looked into <ReactFinalForm />
component and it doesn’t seem to forward the ref.
Maybe using useImperativeHandle
to expose the form api would be a solution?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Forwarding Refs - React
Ref forwarding is a technique for automatically passing a ref through a component to one of its children. This is typically not necessary...
Read more >How to use React's forwardRef function - Felix Gerschau
forwardRef is a helper function from React that allows us to forward a component's ref to another one. This tutorial will teach what...
Read more >Using forwardRef in React to clean up the DOM
React forwardRef is a method that allows parent components pass down (i.e., “forward”) refs to their children. Using forwardRef in React ...
Read more >forwardRef/createRef - React TypeScript Cheatsheets
forwardRef /createRef ... Check the Hooks section for useRef . ... ));. Side note: the ref you get from forwardRef is mutable so...
Read more >How can I use forwardRef() in React? - Stack Overflow
The forwardRef api, (coupled with the useImperativeHandle hook) lets you customize how and where your refs are placed inside your custom ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FYI - this is a breaking change that needs to be fixed in a patch version ASAP.
In v5 this works:
and no longer works in v6 due to the ref not being forwarded by
react-final-form
I have dozens of components that use this:
And since upgrading to v6 of
react-final-form
I’m getting this Warning everywhere:Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?