const userSlice = createSlice({
name: 'user', // 상태이름
initialState, // 위 객체 변수 initialState 사용
reducers: { // reducers = 상태 업데이트를 담당하는 함수들
signInStart: (state) => { // state 인자 = 위 state 상태 값
state.loading = true;
},
signInSuccess: (state, action) => {
state.currentuser = action.payload;
state.loading = false;
state.error = null;
},
signInFailure: (state, action) => {
state.error = action.payload;
state.loading = false;
}
}
});
action 파라미터가 무슨 역할 인지 모르겠음
state 업데이트 해주는 함수임 업데이트 된 state가 payload에 들어감