react-barcode icon indicating copy to clipboard operation
react-barcode copied to clipboard

StrictMode warnings because of renderElement

Open kachkaev opened this issue 5 years ago • 3 comments

👋 @kciter,

Awesome lib, I've been using it for a couple of years!

You've probably heard about the upcoming Concurrent Mode, which imposes some additional restrictions to the components. It seems that react-barcode is not fully compatible because of a string ref begin used. Here is a warning I'm seeing after wrapping <Barcode> into <React.StrictMode>:

Warning: A string ref, "renderElement", has been found within a strict mode tree.
String refs are a source of potential bugs and should be avoided. We recommend
using useRef() or createRef() instead. Learn more about using refs safely here:
https://fb.me/react-strict-mode-string-ref

kachkaev avatar Feb 21 '20 09:02 kachkaev

Same here. I'm getting this on a Next.js project. Warning seems pushed from SSR.

iamchathu avatar Oct 04 '21 15:10 iamchathu

I created a simple hooks based one without this warning react-jsbarcode

iamchathu avatar Oct 07 '21 14:10 iamchathu

Why you don't publish this changes ? there is pr merged to master month ago and in 1.4.1 i still get this strict mode message.... When are you planning to do this ?

robert8888 avatar Mar 02 '22 16:03 robert8888