Closed jakearchibald closed 1 year ago
From https://github.com/preactjs/signals/blob/main/packages/preact/src/index.ts#L345
export function useSignalEffect(cb: () => void | (() => void)) { const callback = useRef(cb); callback.current = cb; useEffect(() => { return effect(() => { callback.current(); }); }, []); }
The signature of useSignalEffect suggests that, if cb returns a function, that function will be used somehow, but it isn't used in the implementation.
useSignalEffect
cb
I'd expect the function returned by cb to be used in a similar way to useEffect, as in it's used as a cleanup function.
useEffect
From https://github.com/preactjs/signals/blob/main/packages/preact/src/index.ts#L345
The signature of
useSignalEffect
suggests that, ifcb
returns a function, that function will be used somehow, but it isn't used in the implementation.I'd expect the function returned by
cb
to be used in a similar way touseEffect
, as in it's used as a cleanup function.