How to mock setState?February 3, 2020 at 10:48am
my event handler change state by using setState I need to mock how can I do that?
February 3, 2020 at 10:53am
I don't think this is the philosophy you should follow for testing things with testing-library. Instead of mocking
setState, you should simulate in your component what your user would do through the UI and then check corresponding elements are present/not present, have proper value etc. This tweet from Ryan Florence sums up this philosophy perfectly https://twitter.com/ryanflorence/status/1127251480098983936