;ul&quot;, list)
    }
}
</code></pre>
<p>Instead, prefer using Javascript expressions such as the ternary operator and Array methods.</p>
<pre><code class="lang-javascript">// PREFER
var BetterListComponent = {
    view: function() {
        return m(&quot;ul&quot;, vnode.attrs.items.map(function(item) {
            return m(&quot;li&quot;, item)
        }))
    }
}
</code></pre>
<h4 id="avoid-creating-vnodes-outside-views"><a href="#avoid-creating-vnodes-outside-views">Avoid creating vnodes outside views<