Skip to content

Warning within React.StrictMode. Legacy API: String Refs #17

@ScorpAL

Description

@ScorpAL
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions