DEV Community

Discussion on: Vue.js and Functional Front-End

Collapse
joestrouth1 profile image
Joe Strouth

I take issue with your example of a normal template.

<template>
  <div>{{ role }} user area</div>
</template>

No need for if statements!

Collapse
proticm profile image
Milos Protic Author • Edited on

I agree with you, but the idea of this post was to put focus on the functional way of doing things.

The template you've provided would do fine in the simple example described in this post since we are only changing the inner text of the element. Each area of the template based on the user role could have a different number of child components and in that case things would be a lot more complicated.

Collapse
joestrouth1 profile image
Joe Strouth

You are right :) There are definitely cases where render functions are much better. I just didn't want new readers to think that Vue templates couldn't do this.

Collapse
equinusocio profile image
Mattia Astorino • Edited on

...it would be a lot more complicated even with jsx.