Instead of testing the function off of the component, I would recommend asserting against the rendered component. I recommend taking a look at react-testing-library and adopting it's approach to writing unit tests. I've been really happy with it in general.
This^ . Also, if you have a function you reeeeally need to test, you can always extract it into a separate file/module/service/whatever, and you can unit test it separately from the functional component.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Instead of testing the function off of the component, I would recommend asserting against the rendered component. I recommend taking a look at react-testing-library and adopting it's approach to writing unit tests. I've been really happy with it in general.
This^ . Also, if you have a function you reeeeally need to test, you can always extract it into a separate file/module/service/whatever, and you can unit test it separately from the functional component.