Skip to content

Instantly share code, notes, and snippets.

@barneycarroll
Created January 22, 2018 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barneycarroll/a8c5933d995744bb1f0c5631bd521065 to your computer and use it in GitHub Desktop.
Save barneycarroll/a8c5933d995744bb1f0c5631bd521065 to your computer and use it in GitHub Desktop.
Inline node reference assignment in Mithril
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