cet-redux-saga-toolkit v1.0.2
redux-saga-toolkit
redux-saga-toolkit
Table of contents
Interfaces
Type Aliases
Variables
Functions
- commonReducer
- createCommand
- createHOCDecorator
- makeStoreCreator
- takeLatestCommandSafe
- takeLatestSafe
- watchCommandChapter
Type Aliases
ArgumentSelector
Ƭ ArgumentSelector\<Selector
>: (...args
: any
[]) => Selector
Type parameters
Name |
---|
Selector |
Type declaration
▸ (...args
): Selector
Parameters
Name | Type |
---|---|
...args | any [] |
Returns
Selector
Defined in
GenericSelector
Ƭ GenericSelector\<State
, Result
>: (state
: State
) => Result
Type parameters
Name |
---|
State |
Result |
Type declaration
▸ (state
): Result
Parameters
Name | Type |
---|---|
state | State |
Returns
Result
Defined in
HOC
Ƭ HOC: FC
\<{}>
Defined in
commonState
Ƭ commonState: ReturnType
\<typeof commonReducer
>
Defined in
Variables
errorSlice
• Const
errorSlice: Slice
\<errorState
, { clearError
: (state
: errorState
, __namedParameters
: { payload
: string
; type
: string
}) => {} ; resetErrors
: () => {} ; setError
: (state
: errorState
, __namedParameters
: { payload
: IErrorDetailsPayload
; type
: string
}) => {} }, "errorSlice"
, "errorSlice"
, SliceSelectors
\<errorState
>>
Defined in
loadingSlice
• Const
loadingSlice: Slice
\<loadingState
, { resetLoading
: () => {} ; setLoading
: (state
: loadingState
, __namedParameters
: { payload
: string
; type
: string
}) => {} ; unsetLoading
: (state
: loadingState
, __namedParameters
: { payload
: string
; type
: string
}) => {} }, "loadingSlice"
, "loadingSlice"
, SliceSelectors
\<loadingState
>>
Defined in
Functions
commonReducer
▸ commonReducer(state
, action
): Object
A reducer is a function that accepts an accumulation and a value and returns a new accumulation. They are used to reduce a collection of values down to a single value
Reducers are not unique to Redux—they are a fundamental concept in
functional programming. Even most non-functional languages, like
JavaScript, have a built-in API for reducing. In JavaScript, it's
Array.prototype.reduce()
.
In Redux, the accumulated value is the state object, and the values being accumulated are actions. Reducers calculate a new state given the previous state and an action. They must be pure functions—functions that return the exact same output for given inputs. They should also be free of side-effects. This is what enables exciting features like hot reloading and time travel.
Reducers are the most important concept in Redux.
Do not put API calls into reducers.
Parameters
Name | Type |
---|---|
state | { error : errorState = errorSlice.reducer; loading : loadingState = loadingSlice.reducer } | Partial \<{ error : errorState = errorSlice.reducer; loading : loadingState = loadingSlice.reducer }> |
action | UnknownAction |
Returns
Object
Name | Type |
---|---|
error | errorState |
loading | loadingState |
Defined in
node_modules/redux/dist/redux.d.ts:91
createCommand
▸ createCommand\<Payload
>(name
, saga
): Object
Type parameters
Name |
---|
Payload |
Parameters
Name | Type |
---|---|
name | string |
saga | (action : { payload : Payload ; type : string }) => Generator \<any , void , never > |
Returns
Object
Name | Type |
---|---|
action | IsAny \<Payload , ActionCreatorWithPayload \<any , string >, IsUnknown \<Payload , ActionCreatorWithNonInferrablePayload \<string >, IfVoid \<Payload , ActionCreatorWithoutPayload \<string >, IfMaybeUndefined \<Payload , ActionCreatorWithOptionalPayload \<Payload , string >, ActionCreatorWithPayload \<Payload , string >>>>> |
saga | (action : { payload : Payload ; type : string }) => Generator \<any , void , never > |
Defined in
src/createCommand/createCommand.ts:7
createHOCDecorator
▸ createHOCDecorator\<State
>(storeCreator
): Object
Type parameters
Name | Type |
---|---|
State | extends Object |
Parameters
Name | Type |
---|---|
storeCreator | StoreCreator \<State > |
Returns
Object
Name | Type |
---|---|
HocDecorator | (Story : AnnotatedStoryFn \<ReactRenderer , any >) => Element |
store | ExtendedStore \<State > |
useSetTestState | (stateDiff : Partial \<State >) => void |
Defined in
makeStoreCreator
▸ makeStoreCreator\<State
>(reducer
, rootSaga
): StoreCreator
\<State
>
Type parameters
Name | Type |
---|---|
State | extends Object |
Parameters
Name | Type |
---|---|
reducer | Reducer \<State > |
rootSaga | () => Generator \<any , any , unknown > |
Returns
StoreCreator
\<State
>
Defined in
takeLatestCommandSafe
▸ takeLatestCommandSafe(command
): Generator
\<Generator
\<ForkEffect
\<void
>, void
, unknown
>, void
, unknown
>
Parameters
Name | Type | Default value |
---|---|---|
command | Object | undefined |
command.action | ActionCreatorWithNonInferrablePayload \<string > | actionCreator |
command.saga | (action : { payload : unknown ; type : string }) => Generator \<any , void , never > | undefined |
Returns
Generator
\<Generator
\<ForkEffect
\<void
>, void
, unknown
>, void
, unknown
>
Defined in
src/createCommand/safeEffect.ts:64
takeLatestSafe
▸ takeLatestSafe(actionType
, saga
): Generator
\<ForkEffect
\<void
>, void
, unknown
>
Parameters
Name | Type |
---|---|
actionType | string |
saga | (action : any ) => Generator \<any , any , unknown > |
Returns
Generator
\<ForkEffect
\<void
>, void
, unknown
>
Defined in
src/createCommand/safeEffect.ts:52
watchCommandChapter
▸ watchCommandChapter(chapterExports
): () => Generator
\<AllEffect
\<Generator
\<Generator
\<ForkEffect
\<void
>, void
, unknown
>, void
, unknown
>>, void
, unknown
>
Parameters
Name | Type |
---|---|
chapterExports | commandChapter |
Returns
fn
▸ (): Generator
\<AllEffect
\<Generator
\<Generator
\<ForkEffect
\<void
>, void
, unknown
>, void
, unknown
>>, void
, unknown
>
Returns
Generator
\<AllEffect
\<Generator
\<Generator
\<ForkEffect
\<void
>, void
, unknown
>, void
, unknown
>>, void
, unknown
>