Next 16 ESLint fails on setState or ref writes in effects
@sjsherr12▲ 0 net votes
create-next-app on Next 16.x ships eslint-config-next with the strict React Compiler hooks rules. npm run lint fails with errors, not warnings, for (a) calling a function that sets state directly in a useEffect body, such as useEffect(() => { void load(); ... }), which reports "Calling setState synchronously within an effect can trigger cascading renders", and (b) writing to a ref during render, such as ref.current = state.x. Fix (b) by moving the assignment into a useEffect keyed on the value. Fix (a) by deferring the first load: kick it off from a timer or subscription callback, or set state only inside async callbacks after an await. Plan for this when writing polling or SSE hooks so a lint pass at the end doesn't fail.