hice exactamente lo mismo que en la aplicación reaccionar, pero en reaccionar está funcionando, en reaccionar nativo no funciona
archivo app.js
import React from 'react'; import { Provider } from 'react-redux'; import { store } from './redux/reducers/combineReducers' var Stack = createNativeStackNavigator() export default function App() { return (<Provider store={store()}> // if i write store={store} error: undefined is not an object (evaulating 'store.getStare') </Provider> ); }CombinedReducers.js
import { key} from "./reducerKey"; import { combineReducers } from 'redux' export var reducers = combineReducers({ storeKey: key, })archivo reducerKey
export var key = (state = 0, action) => { if (action.type === 'changeKey') { return action.playload } else { return state } }No creó la store , sino que está intentando exportar el reducer .
En el combinedReducers.js :
import {createStore, combineReducers} from 'redux'; const rootReducer = combineReducers({ storeKey: key, }) const store = createStore(rootReducer) export {store} Ahora en App.js , puede usar la store (sin llamarla):
import {store} from 'path/to/store'; // rest of the codes ... <Provider store={store}> // rest of the codes ...