Menu Close

How to fix Vue js error: Component template should contain exactly one root element?

fix component template error in Vue.js

To fix Vue js error: Component template should contain exactly one root element, we should wrap our elements with one root element in our template.

For instance, we write

<div>
  <div class="form-group">...</div>

  <div class="col-md-6">...</div>
</div> 

to wrap a div around the other divs to clear the error.

Posted in Vue.js

You can also read...