https://kotlinlang.org logo
#react
Title
# react
c

Christian H.

03/29/2023, 5:02 PM
Hi! I wanted to build a reusable component, now I have this inside a custom FC<>:
Copy code
props.detailComponent(id)
That's the part inside the Props interface:
Copy code
var detailComponent: (id: Int?) -> Unit
And thats the prop definition inside the calling FC<>:
Copy code
detailComponent = { id ->
            div {
                +"asfsagsd $id"
            }
        }
Simplified, since the more complex real thing didn't work Problem is, the div won't render - I suppose I can't just inject elements this way. How do I do it the right way? Thanks in advance!
t

turansky

03/29/2023, 5:13 PM
Looks like you need render function instead
c

Christian H.

04/03/2023, 12:26 PM
@turansky you mean as in using Component classes instead of functional components? I can't find a solution doing that ambiguously.
t

turansky

04/03/2023, 1:11 PM
renderOption
as example from Autocomplete
3 Views