createSliceGroup
A function that accepts a name and optionally a parent and creates a SliceGroup object.
The default parent is the rootSliceGroup.
SliceGroups are used to group Slices under some arbitrary named group. This grouping of slices helps organize a large store and eases its navigation in the Redux Dev Tools.
Parameters#
createSliceGroup accepts a single configuration object argument, with the following options:
function createSliceGroup({ /** * The SliceGroup name. */ name: string;
/** * Optional - The SliceGroup's parent. */ parent?: SliceParent | string;})name#
The SliceGroup's name (or '/' to create a root SliceGroup).
With the exception of creating a root SliceGroup, the name cannot contain the path separator '/'.
The name is used to build the path property of the SliceGroup.
parent#
optional - The SliceGroup's parent.
Default value is: rootSliceGroup
When parent is rootSliceGroup the created SliceGroup's reducer will be added to the "root-reducer" (the reducer of the rootSliceGroup).
When parent is a SliceParent, the created SliceGroup's reducer will be added to that parent's reducer.
When parent is a string, it represents the parent's path, and the created
SliceGroup's reducer will needs to be manually added to that parent's reducer.
Return Value#
createSliceGroup returns a SliceGroup object.
Note#
In the rare case (not recommended) where multiple Redux stores are used, create a
root SliceGroup for each store with createSliceGroup({ name: '/' }).