diff --git a/common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/RenderComposableAndLinkToRoot.kt b/common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/RenderComposableAndLinkToRoot.kt new file mode 100644 index 00000000000..3b1c6be3a37 --- /dev/null +++ b/common/compose/src/jsMain/kotlin/dev/inmo/micro_utils/common/compose/RenderComposableAndLinkToRoot.kt @@ -0,0 +1,13 @@ +package dev.inmo.micro_utils.common.compose + +import androidx.compose.runtime.* +import org.jetbrains.compose.web.dom.DOMScope +import org.w3c.dom.Element + +fun renderComposableAndLinkToRoot( + root: TElement, + monotonicFrameClock: MonotonicFrameClock = DefaultMonotonicFrameClock, + content: @Composable DOMScope.() -> Unit +): Composition = org.jetbrains.compose.web.renderComposable(root, monotonicFrameClock, content).apply { + linkWithElement(root) +}