SolidJSS
SolidJSโ€ข11mo agoโ€ข
16 replies
jrainearwills

Parent Get/Set Child Property

Can a parent component somehow set a property or access the property of a child component?

export function Tab(props: {label: string}){
    return (
      <p>{props.label}</p>
    )
}

export function Tabs(props: SomeUsefulGeneric<Tab>>) {
    const kids = children(props.children)
    const labels = kids().map(child => child.label)
    // do stuff with the labels
    return (
        <Paper>
            {kids()}
        </Paper>
    )
}
Was this page helpful?