question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refs warning with React 16

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
JesperWecommented, Oct 2, 2017

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).

0reactions
jamuhlcommented, Oct 2, 2017

If there is anything else - let me know. Thank you.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found