tjjfvi/solid-native

How can I receive an especific signal from createEffect?

Dannark opened this issue · 2 comments

Lets say I have the following situation:

const [a, setA] = createSignal(initialValue);
const [b, setB] = createSignal(initialValue);

createEffect(() => doSomeThing(a()));

How can I filter which one I got the signal from, a() or b() ?

I've read the docs but I could not undestand very well this part. Thanks

Solid automatically tracks dependencies, so when you call a() from within createEffect, solid knows to update that effect whenever a updates. Since you never call b in that effect, it's not a dependency.

(If you haven't already, make sure you read Solid's docs in addition to Solid Native's, as most of the runtime semantics are determined by Solid.)