How can I stop reacting to a signal update? #655
-
I basically just want to know whether a signal has turned I'm using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
You can use a derived memo: const [source, setSource] = createSignal(false);
let switchDone = false;
const target = createMemo(() => switchDone || (switchDone = source())); Update: since source() will only be called off switchDone is false, we can omit untrack. |
Beta Was this translation helpful? Give feedback.
-
Nvm, the promise constructor runs synchronously. Don't mind me. |
Beta Was this translation helpful? Give feedback.
You can use a derived memo:
Update: since source() will only be called off switchDone is false, we can omit untrack.