kentcdodds / ama

Ask me anything!
https://github.com/kentcdodds/ama/issues?q=is%3Aissue+is%3Aclosed
685 stars 75 forks source link

How do I pass values from a hook into a component rendered by a test? #831

Closed hanhanhan closed 4 years ago

hanhanhan commented 4 years ago

Should I? Can I?

https://stackoverflow.com/questions/62732303/how-do-i-pass-values-from-a-hook-into-a-component-rendered-by-a-test

It seems like a trade off between either mocking the hooks props, or going up the tree to call render, then querying for the component to be tested.

Is there anything better?

kentcdodds commented 4 years ago

Hi @hanhanhan,

I have two blog posts that you might appreciate :)

I hope those help. Good luck!