From 014d45f19f7cd4d184c2fcb3c8e81e9c8b922f12 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 17 Nov 2022 21:23:47 +0300 Subject: [PATCH] minor refactoring --- src/jsMain/kotlin/client.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/jsMain/kotlin/client.kt b/src/jsMain/kotlin/client.kt index 58feb53..440338c 100644 --- a/src/jsMain/kotlin/client.kt +++ b/src/jsMain/kotlin/client.kt @@ -43,11 +43,9 @@ suspend fun main() { rsocket.fireAndForget(buildPayload { data(Json.encodeToString(event)) }) } - - var count: Int by mutableStateOf(0) - renderComposable(rootElementId = "root") { val scope = rememberCoroutineScope() + var count: Int by remember{ mutableStateOf(0)} fun setCount(value: Int) { count = value @@ -62,7 +60,7 @@ suspend fun main() { if (event is CounterDataEvent) { count = event.value } - }.launchIn(scope) + }.launchIn(this) } Div({ style { padding(25.px) } }) {