Reputation: 99
For My project I am using one custom hook for navigation some of my screens as from one screen to another screen based on the parameters provide to the function of custom hook. How could I Unit Test it for React Native Custom
const {result} = renderHook(() => {useShoppingCartNavigator()});
The problem is I am getting result.current
as void and unable to call function of the hook
But according to the doc it should be like
result.current.customHookFn();
Upvotes: 4
Views: 4099
Reputation: 11
The callback inside your renderHook is not returning anything because you wrapped your customHook on curlybraces. It should be
const {result} = renderHook(() => useShoppingCartNavigator());
Upvotes: 1