I need to use generics in my react component, it s...
# react
c
I need to use generics in my react component, it seems like what I need can't be done with function components, so I want to use class components. What do I have to do to be able to describe the component inside a Component<P, S> render() function?
div { ... }
returns Unit, but the function requires return type ReactNode?, so my IDE is confused
m
You can use generics with functional components:
Copy code
<https://github.com/JetBrains/kotlin-wrappers/blob/c64e209ff5ffc35c2c1fa0d94a259b24ac848123/kotlin-react-select/src/main/kotlin/react/select/Select.ext.kt#L7>
I think Victor Turansky was the one who referred me to that...
c
Thank you @Mike Dawson, that helped a lot!