useActions
Extract actions
import {
createDuck,
dispatch,
useActions,
StoreChunk
} from '@ngrx-ducks/core';
@StoreChunk()
export class Chunk {
greet = createDuck('Hello 🐥');
farewell = createDuck('Bye 🐥', dispatch<string>());
// other ducks ...
}
export const actions = useActions(StoreChunk);import { Injectable } from '@angular/core';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { map } from 'rxjs/operators';
import { actions } from './chunk';
@Injectable()
export class Effect {
sideEffect = createEffect(() => this.actions.pipe(
ofType(facadeActions.greet),
map(() => facadeActions.farewell('It is about time.'))
));
constructor(private actions: Actions) {}
}Prefix action
Inlining
Last updated
Was this helpful?