0

I've tried the following with no luck, wanted to produce a <!-- Baz --> comment node:

export default { render() { return ( <strong> Foo {/* Baz */} </strong> ) }, } 
2
  • What happens as a result? And why is there a comma? Commented Apr 21, 2021 at 6:06
  • @3r1c Produce a <!-- Baz --> comment node in the DOM tree, trailing comma is a preference thing. Commented Apr 21, 2021 at 6:09

2 Answers 2

0

Although it's not strictly JSX, I haven't better way to achieve this:

import { Comment, h } from 'vue' export default { render() { return ( <strong> Foo {h(Comment, 'Baz')} </strong> ) }, } 
Sign up to request clarification or add additional context in comments.

Comments

-1

This works &lt;-- Baz --&gt;

answer 2:

Babel transform will remove jsx comments,you can update your babel version, view this answer or you can use some hack

2 Comments

That's not a comment node tho.
Babel transform will remove jsx comments,you can update your babel version, view this answer or you can use some hack

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.