我想得到我的ACTIONS状态:LOAD_GROUP但是对象返回我 proto:对象
我的sagas.js
##//SAGAS ##
import { loadGroup } from "../actions/Group"
export function* loadApiDataGroup() {
try {
// API
const response = yield call(axios.get, 'http://localhost:8000/api/group');
yield put(loadGroup(response))
} catch (e) {
console.log('REQUEST FAILED! Could not get group.')
console.log(e)
}
}
export default function* mySaga() {
yield [
loadApiDataGroup(),
]
}
actions.js
##// ACTIONS ##
export function loadGroup(data){ return { type: LOAD_GROUP, data }};
## // REDUCER ##
export default function groupReducer( state= {}, action = {}){
switch (action.type){
case LOAD_GROUP:
return {
...state
}
default:
return state
}
}
root.js
## // ROOT REDUCERS ##
import groupReducer from '../actions/Group'
const reducer = combineReducers({
groupReducer,
});
我的伙伴
## // COMPONENT ##
const mapStateToProps = (state, props) => {
console.log(state., "CONSOLE LOG");
return {
}
};
const mapDispatchToProps = dispatch => {
return { actions: bindActionCreators({ loadGroup }, dispatch)};
}