Tian
Tian

Reputation: 41

How to fix unable to resolve module react redux hooks\useDispatch?

I was trying to use react-redux for my react native app but somehow this problem came up

error: bundling failed: Error: Unable to resolve module `./hooks/useDispatch` from `C:\Users\TF\lesson\node_modules\react-redux\lib\index.js`: The module `./hooks/useDispatch` could not be found from `C:\Users\TF\lesson\node_modules\react-redux\lib\index.js`. Indeed, none of these files exist:;

I have tried reinstalling and rerunning the react-redux@6 but i cant seem to understand why it needs a hook\useDispatch.

How may i go about to get my installation done properly?

Upvotes: 4

Views: 3124

Answers (3)

Moein Hosseini
Moein Hosseini

Reputation: 730

This solution solved my problem, open terminal and run

react-native start --reset-cache and leave it open and run this
react-native run-android in another terminal

Upvotes: 6

Ayoub
Ayoub

Reputation: 11

Try to install the latest version of react-redux "npm i react-redux@latest"

Upvotes: 1

jsog
jsog

Reputation: 1046

If you use expo, then run the following command to reset the expo cache:

expo r -c

This is where I found the information: https://github.com/reduxjs/react-redux/issues/1247

Upvotes: 2

Related Questions