lver as the root object:</p>
<pre><code class="language-javascript">// example 2
m.route(document.body, &quot;/&quot;, {
    &quot;/&quot;: {
        render: function() {
            return m(Layout, m(Home))
        },
    },
    &quot;/form&quot;: {
        render: function() {
            return m(Layout, m(Form))
        },
    }
})</code></pre>
<p>Note that in this case, if the Layout component has <code>oninit</code> and <code>oncreate</code> lifecycle methods, they would only fire on the first route 