Kevv
Kevv
SSolidJS
Created by Kevv on 3/27/2024 in #support
Seems like I found a JSX bug
As long I know, you can add up variables and raw text inside a tag, something like: <p>{myVar} people</p> but if you do that in a SVG's <text> element inside a <For> loop it will throw an error, here is it in the playground: https://playground.solidjs.com/anonymous/c5ffdd2c-b93e-469d-bfc7-e5e49d95ba17 If you delete the % symbol, it will work normally. Is it a bug? or am I breaking some JSX rule?
8 replies
SSolidJS
Created by Kevv on 3/24/2024 in #support
Derived signals with args?
Docs says that we can create derived signals with functions like this:
const double = () => 2 * count();
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>
</>
);
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.
5 replies