以下代碼在更新React.js中的狀態時顯示語法錯誤。更新React.js中的狀態時出現語法錯誤
import { FETCH_POSTS } from '../actions/index';
const INITIAL_STATE = { all:[], post: null};
export default (state=INITIAL_STATE,action) => {
switch(action.type){
case FETCH_POSTS:
return { ...state, all: action.payload.data };
default:
return state;
}
}
拿給我的return { ...state,all:action.payload.data };
'action.payload.data'的確切負載是什麼? – elboletaire