Testing
queryByRole
Returns null for no match; throws for more than one match.
Formal Syntax & Structure
react syntaxreact
screen.queryByRole("alert")Working Example
Example Snippetreact
screen.queryByRole("alert")Returns null for no match; throws for more than one match.
screen.queryByRole("alert")screen.queryByRole("alert")