I am trying to perform some actions when my component did mount, but not immediately. My component looks like something this:
object MyComponent {
def apply = compopnent()
class Backend($: BackendScope) {
def render = {
// Some markup
}
def actions() = setTimeout(1000) {
//... Some state modifications
}
}
val component = ScalaComponent.builder[Unit]("My component")
.renderBackend[Backend]
.componentDidMount(f => f.backend.actions()) // HERE!
.build
}
I get type missmatch. Found SetTimeoutHandle, required react.Callback.
How to use timeout inside componentDidMount?