Hello here i am facing an issue while i am connecting my component to store, it is throwing an error as i am new to react native please help me how to resolve this error.
i also have tried downgrade of the versions but no luck,below are the versions of respected libraries.
"react-redux": "^7.2.2",
"redux": "^4.0.5",
"redux-persist": "^5.6.12",
"redux-thunk": "^2.3.0"
below is my App.js file
import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import AuthNavigator from "./app/navigation/authNavigator";
import DashboarNavigator from "./app/navigation/dashBoardNavigator";
import navigationTheme from "./app/navigation/navigationTheme";
import { Provider } from "react-redux";
import { createStore, applyMiddleware } from "redux";
import { persistStore, persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";
import autoMergeLevel2 from "redux-persist/lib/stateReconciler/autoMergeLevel2";
import { PersistGate } from "redux-persist/lib/integration/react";
import { userReducer } from "./app/store/reducers/index";
import thunk from "redux-thunk";
import { Autherization } from "./app/authentication/AuthComponent";
import { connect } from "react-redux";
const persistConfig = {
key: "root",
storage: storage,
stateReconciler: autoMergeLevel2
};
const pReducer = persistReducer(persistConfig, userReducer);
const store = createStore(pReducer, applyMiddleware(thunk));
const persistor = persistStore(store);
function App(props) {
console.log(props, "kkkkkkk", store.getState());
return (
<Provider store={store}>
<PersistGate persistor={persistor}>
<NavigationContainer theme={navigationTheme}>
<Autherization />
{/* {props && props.user && props.user.token ? (
<DashBoardNavigator />
) : (
<AuthNavigator />
)} */}
</NavigationContainer>
</PersistGate>
</Provider>
);
}
const mapStateToProps = state => {
return {
...state,
user: state.user,
token: state.user ? state.user.access_token : null
};
};
const AppPage = connect(mapStateToProps)(App);
export default AppPage;
export { store };
`
question from:
https://stackoverflow.com/questions/65936323/i-am-unable-to-connect-my-component-to-store-in-react-native-throwing-the-error 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…