Skip to content

Instantly share code, notes, and snippets.

@yoshuawuyts
Created June 29, 2017 14:16
Show Gist options
  • Save yoshuawuyts/bd96731cab025c56a576d5b0f0e86ba7 to your computer and use it in GitHub Desktop.
Save yoshuawuyts/bd96731cab025c56a576d5b0f0e86ba7 to your computer and use it in GitHub Desktop.
var MyForm = require('my-form')
var html = require('html')
module.exports = myView
// Create an instance of MyForm
// - state is mounted as state['my-form']
// - creates an instance that's kept around
//
// Useful because:
// - same instance can be shared across multiple views
// - no worries of which file instantiates things
function myView (state, emit) {
var myForm = MyForm('my-form', state, emit)
return html`
<section>
<h1>My cool form</h1>
${myForm.render()}
</section>
`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment