React hook for managing an Alien Signals effect scope. Effects created within this scope are automatically cleaned up when the component unmounts.
The return type of the callback within the scope.
A function that creates signal effects.
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;} Copy
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;}
React hook for managing an Alien Signals effect scope. Effects created within this scope are automatically cleaned up when the component unmounts.