1

Getting > Mismatching childNodes vs. VNodes: when I am putting two li elements in else or if condition, as follows.

<ul class="nav navbar-nav language">
  <li><nuxt-link :to="switchLocalePath('en')"> <img src="~/assets/images/english.svg"> English</nuxt-link></li>
  <li><nuxt-link :to="switchLocalePath('ar')"> <img src="~/assets/images/arabic.svg"> العربية</nuxt-link></li>
  <li><nuxt-link to="#"> | </nuxt-link></li>
  <template v-if="$auth.loggedIn">
    <li><nuxt-link to="/profile"> Profile </nuxt-link></li>
  </template>
  <template v-else>
    <li><nuxt-link to="/signin"> Sign In </nuxt-link></li>
    <li><nuxt-link to="/signout"> Sign Out </nuxt-link></li>
  </template>
</ul>

enter image description here

Is it allowed to use more than one li element in the template tag using if/else? If not then how can I achieve this task?

Updated: If I am wrapping my whole ul into client-only, this hides the error.

<client-only>
  <ul>
   ....
  </ul>
</client-only>

Is it OK, or are there any other best practices?

zarpio
  • 10,380
  • 8
  • 58
  • 71
  • 2
    Feel free to check [this blog post about hydration](https://blog.lichter.io/posts/vue-hydration-error/) – manniL Mar 10 '21 at 22:16