passing signal to component

i try to pass a signal set function to a component but when i try to use the function inside the component i only get a props.settask is not a function error
<Todo name={cat} settodo={settasks()} list={task()}/>
<Todo name={cat} settodo={settasks()} list={task()}/>
the component inside the main app
export default function todo(props){

return(
<li><button onclick={props.settasks([])}>{props.name}</button></li>
);
}
export default function todo(props){

return(
<li><button onclick={props.settasks([])}>{props.name}</button></li>
);
}
the component
8 Replies
Tommypop
Tommypop2y ago
You're executing the function in when you pass it in So you're essentially passing in undefined settodo={settasks} should work
⛤ND⛤
⛤ND⛤OP2y ago
changed it still getting the same error
Tommypop
Tommypop2y ago
oh yeah, I didn't notice that lol
⛤ND⛤
⛤ND⛤OP2y ago
is this one of thos cases where sloid js only acpets one certian namening ?
Tommypop
Tommypop2y ago
It's because you've named it settodo when you passed it as props The name of the function doesn't get passed, only function itself
⛤ND⛤
⛤ND⛤OP2y ago
i fell incredibly retarted right now but atleast it works now
Tommypop
Tommypop2y ago
yep :)
⛤ND⛤
⛤ND⛤OP2y ago
thanks
Want results from more Discord servers?
Add your server