jariz / jariz/react-truncate-html

Warning within React.StrictMode. Legacy API: String Refs

Open
#17 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
50
Forks
11
PR merge metrics
No merged PRs in 30d

Description

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

Code:
```

...
here’s some HTML'
}}
/>
...

```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by inspecting the Truncate component implementation and locate the "paragraph" string ref reported in the StrictMode warning. Reproduce the example with React 17 StrictMode, then confirm the warning no longer appears while multiline HTML truncation still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.