S
SolidJS2y ago
avant

Forward props

How to forward props from parent to children without losing reactivity?
3 Replies
lxsmnsyc
lxsmnsyc2y ago
splitProps and spread but really there's a lot of ways depending on what kind of "forwarding" you want
avant
avantOP2y ago
I want to make Button component that has all normal button attributes like onClick or class and use that <button> thru Button.tsx
lxsmnsyc
lxsmnsyc2y ago
so yeah you'd want splitProps, define all of the properties you don't want to pass, then spread it to the child
const [local, rest] = splitProps(props, ['myProp']);

return <button {...rest} />
const [local, rest] = splitProps(props, ['myProp']);

return <button {...rest} />
Want results from more Discord servers?
Add your server