Use cases for useImperativeHandle
are few and far between, but if you're testing a component that uses this React hook, you need to wrap any function you expose which results in state updates when called in React's act
utility. Otherwise you could be missing important things in your tests that could result in bugs shipped to production.
In this lesson we'll learn how to identify what needs to be wrapped in act(...)
and how to wrap those interactions.
This is based on my blog post: Fix the "not wrapped in act(...)" warning