تخطَّ إلى المحتوى

Eager State Initialiser (ARCH3307)

هذا المحتوى غير متوفر بلغتك بعد.

Key typescript.react.eager-state-initialiser · Severity info · Category performance

React: flags useState(expensiveCall()) - the call runs on every render and only the first result is kept. The lazy form runs it once.

const [rows, setRows] = useState(parseCsv(file));
const [rows, setRows] = useState(() => parseCsv(file));