Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

reactjs

native

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?

like image 432
Tian Avatar asked Mar 03 '23 18:03

Tian


2 Answers

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

like image 72
Moein Hosseini Avatar answered Mar 09 '23 18:03

Moein Hosseini


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

like image 39
jsog Avatar answered Mar 09 '23 17:03

jsog