Function updateStateContainer

  • A "special" function to instantly modify a registered state container.

    The caveats:

    • reducer does not get called, so the state gets modified beyond reducer
    • as the consequence, no callback listeners (registered with either registerStateChangedCallback() or registerActionDispatchedCallback()`) get invoked.

    This "special" way of modifying state container shouldn't be used in the most circumstances, because modifying the state pulls out the logic outside the reducer.

    The recommended and typical scenario is as the following:

    • dispatch an action (by calling dispatchAction() function)
    • (state container takes the responsibility) to call the reducer
    • reducer gets processed and a new state object is created
    • (in the most of cases) a fragment of state is modified
    • a top level attributes change get detected
    • appropriate listeners get invoked
    • UI gets refreshed/repainted etc.
    • all this above can get logged to the Web Developer Console

    There are cases when you want to modify the state container directly, make it "silently" and immediately: in most cases because of performance optimizations.

    Type Parameters

    • TState extends Object

    Parameters

    • args: {
          config?: Config<TState>;
          containerId: string;
          state?: Partial<TState>;
      }
      • Optional config?: Config<TState>

        The new config of the container.

      • containerId: string

        The id of the container to update. Container must be registered before.

      • Optional state?: Partial<TState>

        The new state of the container.

        Please note, you don't have to provide the whole state, but only necessary set of attributes.

    Returns void

Generated using TypeDoc