orangy
fun main(args: Array<String>) {
document.getElementById("content").react {
div {
routing {
route<CommentsView>("/react") {}
route<CommentView>("/react/:commentId") {}
}
}
}
}
and component like
class Comment(val id: Int, val author: String, val markdown: String) : ReactProps<Comment.Component> {
class Component(props: Comment) : ReactComponent<Comment, Any>(props) {
fun rawMarkup(): String {
val html = marked(props.markdown, sanitize = true)
return html
}
override fun render() = element {
div("area bottom-2") {
strong {
+props.author
}
span {
unsafe {
+rawMarkup()
}
}
}
}
}
}