cet-redux-saga-toolkit
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

redux-saga-toolkit

redux-saga-toolkit

Table of contents

Interfaces

Type Aliases

Variables

Functions

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

src/types/index.ts:16


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

src/types/index.ts:15


HOC

Ƭ HOC: FC<{}>

Defined in

src/types/index.ts:5


commonState

Ƭ commonState: ReturnType<typeof commonReducer>

Defined in

src/state/commonReducer.ts:10

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

src/state/errorSlice.ts:16


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

src/state/loadingSlice.ts:6

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

src/HOCDecorator/index.ts:10


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

src/testing/utils.ts:54


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>

Defined in

src/createCommand/createCommand.ts:25

Readme

Keywords

Package Sidebar

Install

npm i cet-redux-saga-toolkit

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

77.9 kB

Total Files

66

Last publish

Collaborators

  • kirill486