Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

correctness.ui

Avoid legacy React string refs

String refs rely on older React behavior that is harder to analyze and less reliable than callback or object refs.

#Metadata

Rule ID
ts.react.no-string-ref
Severity
medium
Confidence
0.79
Languages
javascript, typescript
Presets
strict
Stability
experimental
Applies to
function
Tags
react, rules-catalog, ui

#Why it matters

Legacy refs obscure ownership, do not compose cleanly, and complicate future migrations away from class-heavy React patterns.

#Remediation

Use `createRef`, `useRef`, or a callback ref so the reference stays explicit and type-safe.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.react.no-string-ref.rule.yaml.