title | date | updated | aliases | draft | description |
---|---|---|---|---|---|
2023년 06월 22일 |
2023-06-22 14:42:12 +0900 |
2023-06-22 14:42:26 +0900 |
false |
미라클 모닝 |
type NestedPartial<T> = {
[K in keyof T]?: T[K] extends Array<infer R> ? Array<NestedPartial<R>> : NestedPartial<T[K]>
};
https://stackoverflow.com/questions/47914536/use-partial-in-nested-property-with-typescript
// src/store/index.ts
const store = configureStore({
reducer: {
movies: moviesReducer,
books: booksReducer
}
})
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
// src/store/slices/moviesSlice.ts
const initialState: {
name: string;
cost: number;
} = {
name: "",
cost: 0,
}
const moviesSlice = createSlice({
name: "movie",
initialState,
reducers: {
changeName(state, action: PayloadAction<string>) {
state.name = action.payload
},
changeCost(state, action: PayloadAction<number>) {
state.cost = action.payload
}
}
})
export const { changeName, changeCost } = moviesSlice.actions
export const moviesReducer = moviesSlice.reducer
- frontend 인증 구현
- 모기 때문에 강제 미라클 모닝을 했다.