SolidJSS
SolidJSโ€ข2y agoโ€ข
4 replies
Kevv

Derived signals with args?

Docs says that we can create derived signals with functions like this:
const double = () => 2 * count();

Is it okay to add args to it? I mean something like this:
const countBy = (factor: number) => factor * count();

// later
return (
  <>
  <p>{count()} time 3 is: {countBy(3)}</p>
  <p>{count()} time 4 is: {countBy(4)}</p>
  </>
);

I know I can just multiply count in the template, but this is just an example, the actual use case is more complex.
Was this page helpful?