39 lines
805 B
JavaScript
39 lines
805 B
JavaScript
|
import React from 'react'
|
||
|
import {createStore, applyMiddleware} from 'redux'
|
||
|
import reducers from './reducers'
|
||
|
import {Provider, connect} from 'react-redux'
|
||
|
import thunk from 'redux-thunk'
|
||
|
import {View, Text} from 'react-native'
|
||
|
import {SetDev, getStoreList} from './actions'
|
||
|
|
||
|
// import pages
|
||
|
import StoreList from './containers/StoreList'
|
||
|
|
||
|
const middleware = [thunk]
|
||
|
|
||
|
const store = createStore(reducers, applyMiddleware(...middleware))
|
||
|
|
||
|
store.subscribe(() => {
|
||
|
console.log(JSON.stringify(store.getState()))
|
||
|
})
|
||
|
|
||
|
class Main extends React.Component {
|
||
|
|
||
|
componentDidMount(){
|
||
|
let {dev} = this.props
|
||
|
store.dispatch(SetDev(dev))
|
||
|
store.dispatch(getStoreList())
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
return (
|
||
|
<Provider store={store}>
|
||
|
<StoreList />
|
||
|
</Provider>
|
||
|
)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
export default Main
|