Chris Legge
Chris Legge

Reputation: 789

Render html with kotlin-react

Been writing a lot of React with kotlin using the front end plugin. It has been amazing thus far doing nothing overly exotic. I am now trying to render stored HTML in my react component.

I am trying to use a plugin that has worked awesome writing regular react with no luck

@JsModule("react-render-html")
external fun renderHtml(html:String):ReactElement

Any ideas on how to do this, i wrote a cheap and easy parser to parse it but i wonder if there is a better way to use a library.

Upvotes: 1

Views: 670

Answers (1)

Chris Legge
Chris Legge

Reputation: 789

was very easy....

@JsModule("html-react-parser")
external fun htmlReactParser(html: String):String

then was able to use it:

    section {
        +htmlReactParser(html = chosen.content)
    }

Upvotes: 2

Related Questions