Function: createEffects()
createEffects<
Actions
>(actions
,effectsFactory
):EffectsFactory
<ActionFnsCreator
<Actions
>>
Defined in: libs/ngrx-toolkit/src/lib/with-redux.ts:180
Creates the effects function to separate the effects logic into another file.
interface FlightState {
flights: Flight[];
effect1: boolean;
effect2: boolean;
}
const initialState: FlightState = {
flights: [],
effect1: false,
effect2: false,
};
const actions = {
init: noPayload,
updateEffect1: payload<{ value: boolean }>(),
updateEffect2: payload<{ value: boolean }>(),
};
const effects = createEffects(actions, (actions, create) => {
return {
init1$: create(actions.init).pipe(
map(() => actions.updateEffect1({ value: true }))
),
init2$: create(actions.init).pipe(
map(() => actions.updateEffect2({ value: true }))
),
};
});
signalStore(
withState(initialState),
withRedux({
actions,
effects,
})
);
Type Parameters
• Actions extends ActionsFnSpecs
Parameters
actions
Actions
effectsFactory
EffectsFactory
<ActionFnsCreator
<Actions
>>
Returns
EffectsFactory
<ActionFnsCreator
<Actions
>>