  if (isInitialized) return;

    var ctx = element.getContext(&quot;2d&quot;);
    /* draws stuff */
}

var view = [
    m(&quot;canvas&quot;, {config: draw})
]

//this creates the canvas element, and therefore, `isInitialized` is false
m.render(document.body, view);

//here, isInitialized is `true`
m.render(document.body, view);</code></pre>
<p>One common way of using <code>config</code> is in conjunction with <a href="mithril.route"><code>m.route</code></a>, which is an unobtrusive extension to links tha