JavaScript

JavaScript

Made by DeepSource

render function should return value JS-0622

Anti-pattern
Minor
vue

It is required to have a return value for every render method. A render function returns a virtual DOM node, commonly named VNode in the Vue ecosystem, which is an interface that allows Vue to write these objects in your browser DOM. They contain all the information necessary to work with Vue.

Bad Practice

<script>
export default {
  render (h) {
    if (condition) {
      return h('div', 'hello')
    }
  }
}
</script>

Recommended

<script>
export default {
  render (h) {
    return h('div', 'hello')
  }
}
</script>