Fixing Act() Warning In Jest
Topic | Source |
---|---|
๐งฉ React | React Testing Library and Jest: The Complete Guide - Udemy |
Don't use act()
manually to fix warnings that tell you to when using React Testing Library. Instead, use one of those functions of RTL because it uses act()
under the hood.
screen.findBy...
screen.findAllBy...
waitFor
user.keyboard
user.click
These function asynchronously, so you probably have to use async
and await
to make them work properly.