react-truncate-html icon indicating copy to clipboard operation
react-truncate-html copied to clipboard

Warning within React.StrictMode. Legacy API: String Refs

Open ScorpAL opened this issue 4 years ago • 2 comments

  • react: 17.0.2
  • react-dom: 17.0.2
  • react-truncate-html: 0.1.7

Code:

<React.StrictMode>
     ...
    <Truncate
        lines={3}
        dangerouslySetInnerHTML={{
            __html: 'Hi, <strong>here’s some</strong> <i>HTML</i>'
        }}
    />
    ...
</React.StrictMode>

Console out:

Warning: A string ref, "paragraph", 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://reactjs.org/link/strict-mode-string-ref
    at Truncate

https://reactjs.org/link/strict-mode-string-ref

ScorpAL avatar Sep 10 '21 06:09 ScorpAL

Pull request #18

ScorpAL avatar Sep 10 '21 09:09 ScorpAL

Hi @jariz - Any update on this? Thx!

jhallmusic avatar Jun 22 '23 19:06 jhallmusic