Derived signals with args?
Docs says that we can create derived signals with functions like this:
Is it okay to add args to it? I mean something like this:
I know I can just multiply count in the template, but this is just an example, the actual use case is more complex.
4 Replies
Yes, that is perfectly fine
Thanks, I was asking just in case, maybe I was breaking some rule or using it the wrong way, you know, the fact you can do somethings not always means you should.
the concept of derivation relies on function composition, there's no specific rule to be understood. The only thing that matters is the call stack.
If u haven't seen it already: https://youtu.be/cELFZQAMdhQ?si=VTqxwjB1tu-UUqpU is a great introduction to solid's reactivity and helped me a lot in getting an intuition to how this composing of reactive functions and automatic managing of dependencies actually work.
SolidJS
YouTube
Intro to SolidJS reactivity (in 5 minutes)
An introduction video that walks you through Solid's reactivity in under 5 minutes.