Пытаюсь объединить несколько редюсеров в один чере combineReducers но не получается.
Вот код:
store.js
import { combineReducers, createStore } from "redux";
const initialStateOne = {
myState: 1,
};
const initialStateTwo = {
myState: 2,
};
const reducerOne = (state = initialStateOne, action) => {
return state;
};
const reducerTwo = (state = initialStateTwo, action) => {
return state;
};
const rootReducer = combineReducers({
one: reducerOne,
two: reducerTwo,
});
export default store = createStore(rootReducer);
App.js
import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import { Provider } from "react-redux";
import store from "./src/store";
import NewComponent from "./src/NewComponent";
const Stack = createStackNavigator();
export default function Navigation() {
return (
<Provider store={store}>
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="NewComponent"
component={NewComponent}
/>
</Stack.Navigator>
</NavigationContainer>
</Provider>
);
}