-element-removal"><a href="#animation-on-element-removal">Animation on element removal</a></h3>
<p>The problem with animating before removing an element is that we must wait until the animation is complete before we can actually remove the element. Fortunately, Mithril offers the <a href="lifecycle-methods.html#onbeforeremove"><code>onbeforeremove</code></a> hook that allows us to defer the removal of an element.</p>
<p>Let&#39;s create an <code>exit</code> animation that fades <code>opacity</code> from 1 t