Mobx map example
Shows mobx's map feature author(s): Matt Ruby
by Matt Ruby
HTML
<div id="react-log"></div>
<div id='react-mount'></div>
<script src="https://cdn.jsdelivr.net/g/[email protected](react.min.js+react-dom.min.js),[email protected]"></script>
<script src="https://unpkg.com/[email protected]/lib/mobx.umd.min.js"></script>
<script src="https://unpkg.com/[email protected]/index.js"></script>
<script src="https://rawgit.com/mattruby/mobx-examples/master/logging-utils.js"></script>
<script>
wrapConsole();
</script>
JavaScript
var control = mobx.observable.map({
className: 'form-control',
name: 'email',
id: 'emailControl'
});
var inputRenderer = mobxReact.observer(function(props) {
return React.createElement('input', props.inputAttributes.toJS());
});
ReactDOM.render(React.createElement(inputRenderer, {inputAttributes: control}), document.getElementById('react-mount'));