Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

create slice redux

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<string, ReducerFunction | ReducerAndPrepareObject>
  // 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<string, ReducerFunction>
  | ((builder: ActionReducerMapBuilder<State>) => void)
})
Source by redux-toolkit.js.org #
 
PREVIOUS NEXT
Tagged: #create #slice #redux
ADD COMMENT
Topic
Name
5+7 =