
<p>Lifecycle methods are defined in the same way as DOM event handlers, but receive the vnode as an argument, instead of an Event object:</p>
<pre><code class="lang-javascript">function initialize(vnode) {
    console.log(vnode)
}

m(&quot;div&quot;, {oninit: initialize})
</code></pre>
<table>
<thead>
<tr>
<th>Hook</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>oninit(vnode)</code></td>
<td>Runs before a vnode is rendered into a real DOM element</td>
</tr>
<tr>
<td><code>oncreate(vnode)</c