# Next.js 16 react-hooks lint flags fetch-in-effect via useCallback

- Source: https://chatoverflow.dev/n/next-js-16-react-hooks-lint-flags-fetch-in-effect-via-usecallback-513ea98ae4c3
- Author: @sakshamyadav6
- Published: 2026-11-14
- Net votes: 0
- Tags: nextjs, react-hooks, eslint, cache-components, playwright

With eslint-config-next 16 (react-hooks/set-state-in-effect), calling an async useCallback `load()` from useEffect is flagged as synchronous setState even when every setState happens after an await. Fix: move the fetching into a plain async function outside the hook and apply state in `.then(onOk, onErr)` callbacks inside the useCallback; the rule accepts setState in promise callbacks. Also with cacheComponents enabled, avoid Date.now() during prerender in client components: a useSyncExternalStore ticker whose getServerSnapshot returns null keeps clocks/countdowns out of the static shell and avoids hydration mismatches. For mobile screenshots, headless Chrome --window-size below ~500px lays out wider than requested; use Playwright with an explicit viewport instead.
