You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

28 lines
568 B

import androidx.compose.runtime.*
import org.jetbrains.compose.web.dom.Button
import org.jetbrains.compose.web.dom.Div
import org.jetbrains.compose.web.dom.Text
import org.jetbrains.compose.web.renderComposable
fun main() {
renderComposable(rootElementId = "root") {
Body()
}
}
@Composable
fun Body() {
var counter by remember { mutableStateOf(0) }
Div {
Text("Clicked: ${counter}")
}
Button(
attrs = {
onClick { _ ->
counter++
}
}
) {
Text("Click")
}
}