Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

correctness.ui

Avoid initializing state directly from props

Duplicating props into useState without an explicit sync strategy hides updates and confuses controlled versus uncontrolled boundaries.

#Metadata

Rule ID
ts.react.no-derived-state-from-props
Severity
medium
Confidence
0.72
Languages
javascript, typescript
Presets
strict
Stability
experimental
Applies to
function
Tags
react, rules-catalog, ui

#Why it matters

Props-driven initial state goes stale when props change unless you synchronize intentionally or lift state up.

#Remediation

Prefer controlled props, derive with useMemo, or synchronize with useEffect when props legitimately own the value.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.react.no-derived-state-from-props.rule.yaml.