An omitted list lets the effect run after every commit of the component. [] represents no reactive dependencies. [id] runs on mount and then when id changes by Object.is comparison. React cleans up the old setup before re-running it with new dependencies, and on unmount. Root Strict Mode adds a development-only setup/cleanup check.
Follow-up Interview Question · What causes an object created during render to retrigger an effect?