S
SolidJS15mo ago
Max

Are there any important considerations to creating signals in control component callbacks like For

Hi, wondering if there's anything to consider in terms of tracking etc in having something like this
<For each={props.data}>
{(data) => {
const [isOpen, setOpen] = createSignal(false);
return <Component data={data} isOpen={isOpen} onClick={()=>setOpen(x=>!x)}/>;
}}
</For>
<For each={props.data}>
{(data) => {
const [isOpen, setOpen] = createSignal(false);
return <Component data={data} isOpen={isOpen} onClick={()=>setOpen(x=>!x)}/>;
}}
</For>
Or if it's actually better to have some intermediary component where the signal to track state is declared in jsx. Thanks
2 Replies
thetarnav
thetarnav15mo ago
It's absolutely fine
Max
MaxOP15mo ago
ah thats beautiful thanks
Want results from more Discord servers?
Add your server