I didn’t see if there’s a way to output raw HTML d...
# compose-web
s
I didn’t see if there’s a way to output raw HTML during the render? I have some HTML coming from a server that is safe that I need to render into an element, but I don’t see how that’s done.
d
Check out side effects. I think DomSideEffect in your case? https://github.com/JetBrains/compose-jb/tree/master/tutorials/Web/Using_Effects
I believe what you can do is get access to a raw htmlelement and set its innerHTML (but it's been a while, could be wrong)
s
It looks like
DomSideEffect
is deprecated. But
DisposableEffect
seems to work:
Copy code
var description by remember { mutableStateOf<String>("") }

Div {
  DisposableEffect(description) {
    scopeElement.innerHTML = description

    onDispose {}
  }
}
d
Ah perfect, that sounds familiar. Glad that works for you!
FYI anyone at JB sees this thread, you may want to update your tutorials around side effects 🙂
👍 1