mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
b831ca8af9
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.
11 lines
273 B
JavaScript
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>;
|
|
}
|