4

I am trying my first react-native application with Redux and on running the application on device getting below error message,

"UnableToResolveError: Unable to resolve module react-redux/native from C:\project\Testing\index.android.js: Module does not exist in the module map or in these directories: C:\project\Testing\node_modules\react-redux"

package.json:

{
"name": "Testing",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.4.1",
"react-native": "0.40.0",
"react-redux": "^5.0.2",
"redux": "^3.6.0",
"redux-thunk": "^2.2.0"
},
"devDependencies": {
"babel-jest": "18.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "18.1.0",
"react-test-renderer": "15.4.1"
},
"jest": {
"preset": "react-native"
}
}

index.android.js:

import React, { AppRegistry } from 'react-native';
import { Provider } from 'react-redux/native';
import App from './src/containers/App';
import configStore from './src/stores/configStore';
const store = configStore();
var TestingApp = React.createClass({
  render () {
    return (
      ...
    );
  }
});
AppRegistry.registerComponent('TestingApp', () => TestingApp);

Kindly assist to solve the issue.

1 Answer 1

12

From index.js of react-redux, you could get that Provider is exported by react-redux directly.

So you should use import { Provider } from 'react-redux' instead of import { Provider } from 'react-redux/native'.

You can also check the example from here.

Sign up to request clarification or add additional context in comments.

1 Comment

May I request you to please add some more context around your answer. Code-only answers are difficult to understand. It will help the asker and future readers both if you can add more information in your post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.