DEV Community

Discussion on: Writing unit tests with React, Typescript, and react-testing-library

Collapse
 
jacobmgevans profile image
Jacob Evans • Edited

Could you use act() on the behavior that is expected to cause a rerender rather than directly changes props?

Collapse
 
wojciechmatuszewski profile image
Wojciech Matuszewski • Edited

In theory - yes, but react-testing-library is already doing that for you (plus some other stuff)

github.com/testing-library/react-t...

(act is used within render and render is used within rerender)