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.

react React.forwardRef warning in react 16.3.0 version

See original GitHub issue

backend.js:6 Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Check the render method of NumberFormat. in Unknown (created by NumberFormat)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
sevketrizacommented, Oct 15, 2019

my solution is wrapping customInput component as class component.

like that class MyCustomInput extends Component { render(){ return <Input {…this.props} /> } }

at the end

<NumberFormat value={result} onChange={e => setResult(e.target.value)} customInput={MyCustomInput} suffix=“%” onBlur={onBlurResult} />

15 Eki 2019 Sal 23:13 tarihinde brunoborta notifications@github.com şunu yazdı:

What’s the solution to this? I have a FC and I am still getting the ugly warning. Anything I can do to bypass and not show the message? I’m passing it like so:

<NumberFormat value={result} onChange={e => setResult(e.target.value)} customInput={Input} suffix=“%” onBlur={onBlurResult} />

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/s-yadav/react-number-format/issues/334?email_source=notifications&email_token=ACVRCDLM7BFNEPWQ7XFI2VTQOYP5VA5CNFSM4IPAB42KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBKCFQA#issuecomment-542384832, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACVRCDMFMHMUW7IBIKGKLFTQOYP5VANCNFSM4IPAB42A .

1reaction
sevketrizacommented, Sep 29, 2019

i solved it like your solution by wrapping with class component.thenks at all

27 Eyl 2019 Cum 13:14 tarihinde Antti Väyrynen notifications@github.com şunu yazdı:

I have got this same issue when using our custom input, which is React.FunctionComponent. I would think you can reproduce this with any custom input which is a function component.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/s-yadav/react-number-format/issues/334?email_source=notifications&email_token=ACVRCDMDTMTCMUF3Z54SN4LQLXMGRA5CNFSM4IPAB42KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7YOILQ#issuecomment-535880750, or mute the thread https://github.com/notifications/unsubscribe-auth/ACVRCDORSG7LPXLXJWXNDKDQLXMGRANCNFSM4IPAB42A .

Read more comments on GitHub >

github_iconTop Results From Across the Web

React v16.3.0: New lifecycles and context API
Version 16.3 introduces a new context API that is more efficient and supports both static type checking and deep updates. Note. The old...
Read more >
Use forwardRef() in React 16.3 - Egghead.io
In this lesson, we look at the new forwardRef() method in React 16.3, and how it helps us forward a ref through a...
Read more >
React 16.3 Forward Refs - YouTube
Learn how to use the new forward refs function in React 16.3.Code:https://codesandbox.io/s/lrxm6roo1zLinks from ...
Read more >
What's New in React 16.3.0 - YouTube
In this video we'll look at "what's new" in React version 16.3. It turns out there are a lot of new features packed...
Read more >
Is adding forwardRef to a function component a breaking ...
0 so we would already have access to forwardRef . We would not require users to upgrade their react version. reactjs · semantic-versioning....
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