JSFiddle - React, Tailwind, and code Playground

by notadam

HTML

<div id="app"></div>

JavaScript

Form = {
  controller: function(attrs) {
		var ctrl = this
    
    ctrl.submit = function(e) {
   		e.preventDefault()
      
    	alert('Foo')
    }
  },
  
  view: function(ctrl, attrs) {    
  	return m('form', { onsubmit: ctrl.submit }, [
    	m('input[type=text]'),
      m('button[type=submit]', 'Submit')
    ])  
  }
}

m.mount(document.getElementById('app'), Form)