onent) : null,
        ]
    }
}
</code></pre>
<p>Next, let&#39;s modify <code>FancyComponent</code> so that it fades out when removed:</p>
<pre><code class="lang-javascript">var FancyComponent = {
    onbeforeremove: function(vnode) {
        vnode.dom.classList.add(&quot;exit&quot;)
        return new Promise(function(resolve) {
            vnode.dom.addEventListener(&quot;animationend&quot;, resolve)
        })
    },
    view: function() {
        return m(&quot;.fancy&quot;, &quot;Hello world&quot;)
  