@trigger

@trigger is used to trigger when effect or state dispatch fires

@trigger(action, options?)

// The action name will be `{sink}/{effect|state}`
type action = string

interface options {
  // trigger excution order, default 0
  priority?: number;
  // lazy loaded trigger will excute after action, default true
  lazyLoad?: boolean;
  // pass raw action object to trigger function, default false
  rawAction?: boolean;
  // formatter use to arguments before it hits trigger function
  formatter?: Function;
}

the trigger is a powerful tool for make redux as an event sourcing system, but may cause infinity loop to redux actions when setting bad triggers, be careful when using it

Last updated