  }
}
</code></pre>
<p><code>vnode.dom</code> points to the root DOM element of the component (<code>&lt;div class=&quot;fancy&quot;&gt;</code>). We use the classList API here to add an <code>exit</code> class to <code>&lt;div class=&quot;fancy&quot;&gt;</code>.</p>
<p>Then we return a <a href="promise.html">Promise</a> that resolves when the <code>animationend</code> event fires. When we return a promise from <code>onbeforeremove</code>, Mithril waits until the promise is resolved and only then it removes 