Files
oxc-project__oxc/crates/oxc_react_compiler/fixtures/error.invalid-derived-computation-in-effect-single-dependency.js
Boshen b831ca8af9 fix(react-compiler): improve derived state diagnostic (#25804)
Improve `react/no-deriving-state-in-effects` diagnostics with labeled state updates, named reactive dependencies, and actionable render guidance. Adds fixture coverage for single and multiple dependencies.

AI assistance was used for this change.
2026-08-17 14:33:28 +00:00

11 lines
273 B
JavaScript

// @validateNoDerivedComputationsInEffects
import {useEffect, useState} from 'react';
function Component({value}) {
const [normalized, setNormalized] = useState('');
useEffect(() => {
setNormalized(value.trim());
}, [value]);
return <div>{normalized}</div>;
}