Replies: 1 comment 1 reply
-
You can pretty easily support this with a simple import { signal, effect, useSignalEffect } from '@preact/signals';
const count = signal(0);
const initialized = signal(false);
effect(() => {
count.value;
if (!initialized.peek()) return initialized.value = true;
console.log(count.value);
});
count.value++; This does get more complicated the more an effect does, but we'd encourage users to keep effects small. Edit: |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Solid.js has a
on
utility that allows you to explicitly define dependencies with the option to defer until the next value changes. Maybe we have something similar for @preact/signals?Beta Was this translation helpful? Give feedback.
All reactions