Hex Core JS
    Preparing search index...

    Function useReactiveDFA

    • A hook for simulating a deterministic finite automaton (DFA). for most practical purposes use the useObservableDFA hook.

      Type Parameters

      • Status extends string
      • Signal extends string

      Parameters

      • initialStatus: Status

        The initial state for the the automaton.

      • statusMap: StatusMap<Status, Signal>

        An object defining the automaton.

      • Optionalstrict: boolean

        A flag indicating whether bad signals should throw an error or silently ignored.

      Returns ReactiveDFAState<Status, Signal>

      a tuple with the current state, and a transition function taking signals and returning the next state (or the current state if not in strict mode and received a bad signal).