//reducers
const reducer1 = (state = {"test":"nihao"}, action= {}) => {
switch (action.type) {
case 'xxx':
default:
return state;
}
}
const reducer2 = (state = {}, action= {}) => {
switch (action.type) {
case 'xxx':
default:
return state;
}
}
export default {reducer1,reducer2};
import {createStore, combineReducers, applyMiddleware}
from 'redux';
import reducer
from '../reducers/reducer';
var store = createStore(
combineReducers(reducer),
applyMiddleware(thunk)
);
export
default store;
import React from 'react';
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import route from './js/route/route';
import store from './js/store/store';
store.subscribe(
function () {
})
ReactDOM.render(
<Provider store = {store}>
{route}
</Provider>,
document.getElementById(
"app")
)
import { connect } from
'react-redux';
import actionCreators from
'../actions/action';
class Index extends Component{
constructor(props) {
super(props);
this.state =
this.props.state;
let {GET_DATA_START} =
this.props;
GET_DATA_START(state);
}
render(){
return(
)
}
}
export
default connect((state) => {
return { state: state.reducer1 }, actionCreators)(Index)
转载请注明原文地址: https://ju.6miu.com/read-1000321.html