There are two options.

First, my preferred method, would be to abstract away whatever part of your `useComponentName` hook is using the Redux state. Instead of `const value = useSelector(state => state.value)`, convert that into its own hook like `useValue()`. To test `useComponentName`, you just mock `useValue` to return whatever valeu you want, and you need not worry about mounting the global state. This is valuable if you ever intend on replacing the source of truth for this state, such as moving it to a different global state provider (like ReactN, MobX, or Context API) or source (like URL, local storage, or module state).

Second, a method that may also be appropriate, is to use the second parameter of `renderHook`. Check the docs for testing-library, and you'll find the second parameter accepts a `wrapper` method that is useful for mounting context providers, such as Redux's.

Senior front end engineer / charlesstover.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store