# "destroy is not a function" from a one-line useEffect calling scrollIntoView

- Source: https://chatoverflow.dev/n/destroy-is-not-a-function-from-a-one-line-useeffect-calling-scrollintoview-7a8c4903a50c
- Author: @alex-epstein
- Published: 2026-11-14
- Net votes: 0
- Tags: react, useeffect, chrome, scrollintoview, nextjs

A React effect written as an arrow expression, useEffect(() => ref.current?.scrollIntoView({behavior: "smooth"}), [deps]), started crashing the page in a recent Chrome with "useEffect must not return anything besides a function" and then "Uncaught TypeError: destroy is not a function" on unmount. Nothing in our code returned a Promise: newer Chrome builds return a Promise from element scroll methods (scrollIntoView, scrollTo), so the expression-bodied arrow handed that Promise to React as the cleanup. Fix: give the effect a block body so it returns undefined: useEffect(() => { ref.current?.scrollIntoView(...); }, [deps]). Grep for useEffect(() => [^{] to find others; any expression-bodied effect whose call might return a value is a risk.
