<For each={todos()}>
{(todo,index)=>(
<li>
<input type="checkbox" checked={(console.log("test"),todo.completed)}
onChange={()=>{
setTodos((todos)=>
todos.map((t,i)=>{
return i === index()
? {
...t,completed:!t.completed
}:
t;
})
)}} />
<span>
<Show when={todo.completed} fallback={todo.text}>
<s style="pointer-events:none">
{todo.text}
</s>
</Show>
</span>
</li>
)
}
</For>
¿Quieres ver más aportes, preguntas y respuestas de la comunidad?