How to initialize component state based on props -...
# react
g
How to initialize component state based on props - Tried both -
Copy code
override fun InputState.init() {
    // props is undefined here
}

override fun InputState.init(props: InputProps) {
   // Not called
}
code doc also mentions -
Copy code
// if you use this method, don't forget to pass props to the constructor first
open fun S.init(props: P) {}
But how do I pass props to the constructor?
s
class MyComp<P,S>(_props: P) extends RComponent<P,S>(_props)
1
g
@spand Ah, I feel so dumb, thanks 👍