Answer the question
In order to leave comments, you need to log in
How to remove div from template?
there is template `myHello`:
<div>
<h2>Hello</h1>
<p>world</p>
</div>
<h1>my hello:</h1>
<my-hello><my-hello>
<h1>my hello:</h1>
<div>
<h2>Hello</h1>
<p>world</p>
</div>
Answer the question
In order to leave comments, you need to log in
Any component MUST have a root wrapper tag. Nothing without this. This limitation exists in React as well. Clean up except with crutches, which is not recommended, of course.
Read up on slot in components, you can use it to display your h1 inside a div if you don't want to put h1 in the component itself.
Agree with the previous commenter, it is possible to use a slot in your my-hello component:
<div>
<slot name="title"></slot>
<h2>Hello</h1>
<p>world</p>
</div>
<my-hello>
<h1 slot="title">my hello:</h1>
</my-hello>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question