ryannerd
02/14/2018, 7:56 AMSetState(JSobject, function(){callBack code})
is as @Filipp Riabchun said the state is batched and asynchronous. Meaning that the state change isn't immediate and in JS React if you need to have some action occur when the state actually changes you include a call back function as the second argument. I'm not sure how Kotlin transpiles the JS for this.Filipp Riabchun
02/14/2018, 8:08 AMsetState(jsObject {
// type is infered
foo = "bar"
}) {
// your callback
}
Or like that, if you need to use previous state values:
setState ({
jsObject {
bar = it.bar + 1
}
}) {
// your callback
}