Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Mithril + Mobx Hello World
<div class="container" id="main">
<div class="row">
<div class="col-xs-12 col-md-6">
<div id="app"></div>
</div>
</div>
</div>
/** @jsx m */
const store = mobx.observable({
userName: "Ramnath"
})
const Hello = {
view(ctrl, props){
return (
<h2>Hello {props.store.userName}</h2>
)
}
}
mobx.autorun(() =>
m.mount(
document.getElementById("app"),
<Hello store={store} />
)
)
<script src="//npmcdn.com/mobx@2.1.0/lib/mobx.umd.js"></script>
<script src="//npmcdn.com/mithril@0.2.4/mithril.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.