Get started with mithril CDN

MIT licensed

Mithril is a lightweight JS framework for building single-page applications.

Tags:
  • mvc
  • browser

Stable version

Copied!

How to start using mithril CDN


// Import Mithril
import h from 'mithril/h';

// Define a component called "Hello"
const Hello = {
  view() {
    return h('div.hello', [h('h1', 'Hello, World!')]);
  }
};

// Define the main component called "App"
const App = {
  view() {
    return h('div.app', [h(Hello)]);
  }
};

// Initialize the application and mount it to the body element
m.mount(document.body, {view: App});
Copied!
Copied!
Copied!

All versions