eing defined as a component to avoid repetition:</p>
<pre><code class="language-javascript">var Menu = {
    view: function() {
        return m(&quot;nav&quot;, [
            m(&quot;a[href=/]&quot;, {oncreate: m.route.link}, &quot;Home&quot;),
            m(&quot;a[href=/page1]&quot;, {oncreate: m.route.link}, &quot;Page 1&quot;),
        ])
    }
}</code></pre>
<p>Now we can define routes and map our components to them:</p>
<pre><code class="language-javascript">m.route(document.body, &quot;/&quot;, {
  