Andrey Ponomarenko
Andrey Ponomarenko

Reputation: 581

Vue2. How to use v-html in JSX

I have quite a short question.

How to use v-html directive in vue JSX syntax?

Thanks in advance for an answer.

Upvotes: 6

Views: 4696

Answers (1)

acdcjunior
acdcjunior

Reputation: 135752

Use domPropsInnerHTML (one word, exactly like this, see below).

Example:

export default {
  name: "app",
  data() {
    return {
      msg: 'Something foo bar'
    }
  },
  render() {
    return (
      <h1 domPropsInnerHTML={this.msg}></h1>
    );
  }
};

CodeSandbox demo here.

Upvotes: 14

Related Questions