Skip to main content

Output controller values

NameTypeDescriptionDefault value
idstringThe id value will be equal to the prefix. Readonly.'c-state'
actionsobjectReturn the object with default action creators and your action creators.-
selectfunctionMethod to get state of a particular controller.-

How select works

controller.select(state: ReduxState): Partial<ReduxState>

Action types

ts
import { Controller, create } from 'redux-saga-controller';

interface IInitial {
initialized: boolean;
disabled: boolean;
data: UserData | null
}

export const controller:Controller<IInitial> = create({
prefix: 'testController',
actions: ['initialize', 'getSelf'], // TYPE: "@testController-state/initialize" TYPE: "@testController-state/getSelf"
initial: {
initialized: false,
disabled: true,
data: {
name: 'John',
age: 30,
}
},
subscriber: function * () {
// ...
},
});
ts
import { Controller, create } from 'redux-saga-controller';

interface IInitial {
initialized: boolean;
disabled: boolean;
data: UserData | null
}

export const controller:Controller<IInitial> = create({
prefix: 'defaultPrefix',
actions: {
initialize: 'INITIALIZE', // TYPE: "@defaultPrefix-state/INITIALIZE"
getSelf: 'GET_SELF', // TYPE: "@defaultPrefix-state/GET_SELF"
},
initial: {
initialized: false,
disabled: true,
data: {
name: 'John',
age: 30,
}
},
subscriber: function * () {
// ...
},
});