Ich folge der Demo, um ein Projekt zu erstellen. Ich benutze reactive-native mit Redux, dann bekomme ich diesen Fehler "undefined ist keine Funktion (Bewertung '(0, _redux.createStore) (_ todoListRedux.reducer)')` ".reactive-native mit Redux-Fehler
Dies ist mein Code:
index.android.js
import {AppRegistry, View} from 'react-native'
import {createStore} from 'redux'
import {reducer} from './todoListRedux'
const store = createStore(reducer)
import App from './App'
const AppWithStore =() => <App store={store} />
AppRegistry.registerComponent('redux',() => AppWithStore)
todoListRedux.js
export const types = {
ADD: 'ADD',
REMOVE: 'REMOVE',
}
export const actionCreators = {
add: (item) => {
return {type: types.ADD, payload: item}
},
remove: (index) => {
return {type: types.REMOVE, payload: index}
}
}
const initialState = {
todos: ['Click to remove', 'Learn React Native','Write Code','Ship App'],
}
export const reducer = (state = initialState, action) => {
const {todos} = state
const {type, payload} = action
switch(type) {
case types.ADD: {
return {
...state,
todos: [payload, ...todos],
}
}
case types.REMOVE: {
return {
...state,
todos: todos.filter((todo,i) => i !== payload),
}
}
}
return state
}
jede mögliche Hilfe geschätzt wird!
Haben Sie wirklich injizieren Geschäft Kontext in App reagieren? So etwas wie von react-redux package? –
vovkasm