Hook for managing the execution of an effect based on changes in dependencies.

  • Parameters

    • effect: EffectCallback

      The effect to be executed.

    • Optionaldeps: any

      The dependencies to watch for changes.

    • OptionalstopWatchByDefault: boolean

      Whether to initially stop watching for changes.

    Returns { beginWatch: () => void; resetWatcher: () => void; stopWatch: () => void }

    • An object containing utility functions for managing the watcher.