Nikola Milovic
09/27/2021, 9:51 AMval chatSidebar = fc<ChatProps> { props -> // the fc that I want to pass
-----
external interface SidebarProps : PropsWithChildren {
var sidebarContent: FunctionComponent<Props> // want to pass it here
}
val sidebar = fc<SidebarProps> { props ->
div { props.sidebarContent } // somehow do something like this
props.children() //already using children for the main content
This is how I want to use the sidebar
sidebar {
when (child) {
is Main.Child.Chat -> {
attrs.sidebarContent = chatSidebar{} // add the corresponding content to the props alongside the main content
chat { attrs.component = child.component} // the child/ main content
turansky
09/27/2021, 10:01 AMsidebarContent
is FC
:
div { props.sidebarContent() }
Nikola Milovic
09/27/2021, 10:06 AMNo value passed for parameter 'handler'
div { props.sidebarContent() }
When they come from the parent component
And another one is how to actually assign the functional component to the attribute.Nikola Milovic
09/27/2021, 10:06 AMThis is the sidebarcontent
external interface ChatSidebarProps : Props {
var component: Chat
}
val chatSidebar = fc<ChatProps> { props ->
turansky
09/27/2021, 10:09 AMsidebar: ReactNode
attrs.sidebar = createElement(ChatSidebar, jso { component = ... })
turansky
09/27/2021, 10:10 AMbuildElement
to build isolated nodeturansky
09/27/2021, 10:11 AMcreateElement
is fine, if you have just one elementNikola Milovic
09/27/2021, 10:12 AMjso { component = ... })
Jso is not resolved, maybe I am a bit outdated on the dependencies
Edit: probably jsobject?turansky
09/27/2021, 10:31 AMjso
- short alias for jsObject
Nikola Milovic
09/27/2021, 10:53 AMturansky
09/27/2021, 11:58 AM