我学习了本机和redux的反应,而且我的代码中有一个我无法解决的问题。 当我在iPhone模拟器(iOS 10.3)上运行我的代码时,我得到错误:"期望减速器成为一个功能"。
以下是我的所有代码(非常简短,非常基本):
的src / app.js:
import React from 'react';
import { View } from 'react-native';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import reducers from './reducers';
import {Header} from 'native-base';
const App = () => {
return(
<Provider store={createStore(reducers)}>
<View>
<Header />
</View>
</Provider>
)
}
export default App;
的src /减速器/ index.js:
import { combineReducers } from 'redux';
export default combineReducers({
libraries: () => []
});
index.ios.js:
import {AppRegistry} from 'react-native';
import App from './src/app';
AppRegistry.registerComponent('project', () => App);
谢谢大家, Roei。
答案 0 :(得分:1)
我犯的错误是使用import { reducers } from '../reducers/myReducer';
而不是import reducers from '../reducers/myReducer';
,这会产生相同的错误消息。