How smart/dumb idea is is to pass the `StateInstan...
# react
p
How smart/dumb idea is is to pass the
StateInstance
delegate in
Props
? 🤔 So then child components could easily change state of parent component.
t
Change -
StateSetter
Common practice - use handlers/event handlers instead
p
Any example?
t
Copy code
interface MyControlProps: {
    var value: Data
    var onChange: (Data) -> Unit // handler
}

val MyControl = fc { ... }
In case of shared state you can use React context to render only parts, which use shared context