Typeerror: Undefined Is Not An Object (evaluating 'store.getstate')
Solution 1:
It seems the import statement is not right. It should be:
importStorefrom'./src/Store';
Solution 2:
if you're importing a single named export
e.g where you've done export const MyComponent = () => {}
you'd import it like import { MyComponent } from "./MyComponent"
if you're importing a default export
e.g where you've done const MyComponent = () => {} export default MyComponent
you'd import it like import MyDefaultComponent from "./MyDefaultExport"
Solution 3:
I got this error because I was exporting the wrong component from my main App file.
I was exporting this:
importReactfrom'react'import { Provider } from'react-redux'import { createAppContainer } from'react-navigation'importNavigatorfrom'./src/components/Navigator'import { store } from'./src/store'constApp = createAppContainer(Navigator);
constWrapped = props => (
<Providerstore={store}><App /></Provider>
)
exportdefaultProvider; // wrong!
That last line should be:
exportdefault Wrapped; // right!
Solution 4:
The answer from Itunu Adekoya shows that you can decide how you want to export / import, and in this case about personal preference, as there isn't a perf difference.
In the case where you have a lot of exports from a file, and perhaps some are unrelated or won't all be used together, it is better to export them individual as consts and then in other file only import what you need via import { } format, this will be sure to only include relevant imprts
Post a Comment for "Typeerror: Undefined Is Not An Object (evaluating 'store.getstate')"