Skip to content
masterclass Buddy

React Testing Library · Function

waitForElementToBeRemoved

waitForElementToBeRemoved waits for an existing element or elements to leave the DOM. It accepts a node, an array, or a callback that finds them, and returns a Promise.

Last updated

Syntax

function waitForElementToBeRemoved<T>(callback: (() => T) | T, options?: { container?: HTMLElement; timeout?: number; interval?: number; onTimeout?: (error: Error) => Error; mutationObserverOptions?: MutationObserverInit }): Promise<void>

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • waitFor
  • findBy queries
  • queryBy queries
  • queryAllBy queries

Source: Async Methods | Testing Library. Checked 2026-11-03.