📜  创建切片 redux - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:51.111000             🧑  作者: Mango

代码示例1
function createSlice({
  // A name, used in action types    name: string,
  // The initial state for the reducer
  initialState: any,
  // An object of "case reducers". Key names will be used to generate actions.
  reducers: Object
  // A "builder callback" function used to add more reducers, or
  // an additional object of "case reducers", where the keys should be other
  // action types
  extraReducers?:
  | Object
  | ((builder: ActionReducerMapBuilder) => void)
})