Refs warning with React 16
See original GitHub issueI am upgrading my i18next based app to React 16, and getting plenty of Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail. from inside i18next.
Is this a know issue with the current version under React 16?
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Refs Must Have Owner Warning - React
This usually means that you're trying to add a ref to a component that doesn't have an owner (that is, was not created...
Read more >Warning: Stateless function components cannot be given refs ...
Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.null after updating to React 16 #10831.
Read more >Deprecation warning using this.refs - Stack Overflow
We advise against it because string refs have some issues, are considered legacy, and are likely to be removed in one of the...
Read more >How to use React createRef - LogRocket Blog
Starting from React v16.3, the React API included a createRef() method that can be used for creating refs in much the same way...
Read more >next link function components cannot be given refs. attempts ...
next-dev.js?3515:25 Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef ...
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

A bit of luck. Adding withRef: false made 3 out 7 errors move over to a different traceback, which made me suspect that the error was in a different component.
So it’s not an i18next problem, probably just React 16 tracebacks being slightly weird (not surprising since they changed a lot of that code).
If there is anything else - let me know. Thank you.