useEffectScope top-level property

_JoltEffectScopeHookCreatorImpl useEffectScope
final

Creates an effect scope hook for managing groups of effects.

Effect scopes allow you to group related effects and dispose them together.

Parameters:

  • detach: Whether to detach the scope from the current effect context
  • onDebug: Optional debug callback for reactive system debugging

Returns: An EffectScope for managing effect lifecycles

Example:

setup(context, props) {
  final scope = useEffectScope();

  onMounted(() {
    scope.run(() {
      final signal = Signal(0);
      Effect(() => print(signal.value));

      onScopeDispose(() => print('Scope cleaned up'));
    });
  });

  return () => Text('Hello');
}

Implementation

final useEffectScope = _JoltEffectScopeHookCreatorImpl();