react-alien-signals
    Preparing search index...

    Function useSignalScope

    • React hook for managing an Alien Signals effect scope. Effects created within this scope are automatically cleaned up when the component unmounts.

      Parameters

      • callback: () => void

        A function that creates signal effects.

      • deps: DependencyList = ...

      Returns () => void

      A stop function to cancel the scoped effects.

      function ScopedEffects() {
      const stopScope = useSignalScope(() => {
      createEffect(() => {
      console.log('Scoped effect:', someSignal());
      });
      });

      // Optionally, you can stop the scope manually if needed:
      // useEffect(() => () => stopScope(), [stopScope]);

      return null;
      }