Created
January 22, 2018 15:05
-
-
Save barneycarroll/a8c5933d995744bb1f0c5631bd521065 to your computer and use it in GitHub Desktop.
Inline node reference assignment in Mithril
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
const login = { | |
view : ({state}) => | |
m('form#login', { | |
onsubmit: e => { | |
e.preventDefault() | |
console.log( | |
state.email.dom.value, | |
state.pass.dom.value, | |
) | |
}, | |
}, | |
state.email = m('input[type=email].email'), | |
state.pass = m('input[type=password].pass'), | |
m('button[type=submit]', | |
'Sign in', | |
), | |
), | |
} | |
m.mount(document.body, login) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment