-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathApp.js
37 lines (32 loc) · 1.08 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import React from 'react';
import { AppRegistry } from 'react-native';
import Propagate from './app/components/Propagate';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, combineReducers, compose} from 'redux';
import thunkMiddleware from 'redux-thunk';
import { createLogger} from 'redux-logger';
import reducer from './app/reducers';
// initialize logger
const loggerMiddleware = createLogger({ predicate: (getState, action) => __DEV__ });
// initialize redux store with middleware
function configureStore(initialState) {
const enhancer = compose(
applyMiddleware(
thunkMiddleware, // lets us dispatch() functions
loggerMiddleware
)
);
return createStore(reducer, initialState, enhancer);
}
const store = configureStore({});
// wraps app in provider to use redux store
export default class App extends React.Component {
render() {
return (
<Provider store={store}>
<Propagate />
</Provider>
);
}
}
AppRegistry.registerComponent('App', () => App);