Closed ramyareye closed 6 years ago
Try using dynamic import instead.
const store = () => require("../store/index").default;
const accessToken = store().getState().auth.accessToken;
no hope this is my index.js
import React from 'react'
import { Provider } from "react-redux"
import { AppRegistry } from 'react-native'
import App from './app/App'
import store from 'store'
const Application = () => (
<Provider store={store}>
<App />
</Provider>
)
AppRegistry.registerComponent('App', () => Application)
If I import store before the App the error is gone but then .getState() doesn't work. I'm a bit confused, box is working well inside app but here in my api.js which is called in one of store sagas doesn't, strange!
The issue is caused by static resolution of modules, you should try dynamic imports (using require
instead of import
) as suggested in my previous comment.
Hi,
After using this lines I got the error :
Possible to be a bug or my code mistaken ?
Thanks