![]() ![]() By using this, you can write all the code you need for your Redux store in a single file. Redux toolkit includes all the tools, you want for a Redux application. ImmerJs has an autoFreeze option that freezes objects from change which means this reducer can't be migrated to createSlice // because the state would become frozen and during run time we would get errors because Angular would try to mutate // the frozen state. Redux Toolkit (RTK), previously known as Redux Starter Kit, provides some options to configure the global store and create both actions and reducers in a more streamlined manner. Redux Toolkit uses ImmerJs as part of their solution to ensure that state objects are not mutated. The second argument is a so-called prepare function which wecan use to. ![]() The action creator can be called either without arguments or with a payload to be attached to the action. It takes an action type and returns an action creator for that type. The function itself has toString() defined, so that it can be used in place of the type constant. The createAction helper combines these two declarations into one. ![]() Import as DataSourcePluginMeta,Įxport const dataSourceLoaded = createAction( 'dataSources/dataSourceLoaded') Įxport const dataSourcesLoaded = createAction( 'dataSources/dataSourcesLoaded') Įxport const dataSourceMetaLoaded = createAction( 'dataSources/dataSourceMetaLoaded') Įxport const dataSourcePluginsLoad = createAction( 'dataSources/dataSourcePluginsLoad') Įxport const dataSourcePluginsLoaded = createAction(Įxport const setDataSourcesSearchQuery = createAction( 'dataSources/setDataSourcesSearchQuery') Įxport const setDataSourcesLayoutMode = createAction( 'dataSources/setDataSourcesLayoutMode') Įxport const setDataSourceTypeSearchQuery = createAction( 'dataSources/setDataSourceTypeSearchQuery') Įxport const setDataSourceName = createAction( 'dataSources/setDataSourceName') export const setIsDefault = createAction( 'dataSources/setIsDefault') The first one is the action type and its required. createAction(): generates an action creator function for the given action type string. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |