Options
All
  • Public
  • Public/Protected
  • All
Menu

Module util/stateManagement

Index

Functions

Functions

Const useReaction

  • useReaction<T>(expression: (reactionObject: IReactionPublic) => T, effect: (expressionResult: T, prevExpressionResult: T, reactionObject: IReactionPublic) => void, options?: IReactionOptions): void
  • A simple convenience hook that creates a reaction with provided expression, effect and options. Reaction will be created only once (will not be disposed/recreated between renders). Reaction will be automatically disposed when the component is unmounted. If this reaction creates other reactions, those reactions will NOT be disposed. In that case create a reaction manually inside a useEffect hook as described in mobx-react documentation.

    Type parameters

    • T: unknown

    Parameters

    • expression: (reactionObject: IReactionPublic) => T
        • (reactionObject: IReactionPublic): T
        • Parameters

          • reactionObject: IReactionPublic

          Returns T

    • effect: (expressionResult: T, prevExpressionResult: T, reactionObject: IReactionPublic) => void
        • (expressionResult: T, prevExpressionResult: T, reactionObject: IReactionPublic): void
        • Parameters

          • expressionResult: T
          • prevExpressionResult: T
          • reactionObject: IReactionPublic

          Returns void

    • Optional options: IReactionOptions

    Returns void

Generated using TypeDoc