A Pen by Ramnath Vaidyanathan on CodePen.
Forked from ramnathv/Mithril + Mobx Hello World.markdown
Created
August 11, 2016 04:12
-
-
Save HendrikRoth/97acf14bc8bd894ce643a7bb3c227d7d to your computer and use it in GitHub Desktop.
Mithril + Mobx Hello World
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container" id="main"> | |
<div class="row"> | |
<div class="col-xs-12 col-md-6"> | |
<div id="app"></div> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @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} /> | |
) | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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