How can I render children in functional component ...
# react
n
How can I render children in functional component with PropsWithChildren?, it doesnt seem to work with single children
Copy code
val MainScreen = fc<MainProps> { props ->
...
    sidebar { // has props with children
        when (child) { // this causes crash
            is Main.Child.Chat ->  p{attrs.text("heloooo test")}
            else -> p{attrs.text("heloooo error")}
        }
    }
}

external interface SidebarProps : PropsWithChildren {
}

val sidebar = fc<SidebarProps> { props ->
    props.children?.forEach {
                    child(it)
                }
}
t
props.children()
Example
+props.children
c
Indeed correct, thank very much Victor !!!