import {render,app} from 'deku'
// Define our custom element. The render method should
// return a new virtual element.
var App = {
render: function ({ props, state }) {
return {
type: 'p',
attributes: { color: props.color }
}
}
}
// Then create a virtual element with our custom type
var app = tree({
type: App, // <- custom type instead of a string
attributes: { color: 'red' } // <- these become 'props'
})
// And render it to the DOM
render(app, document.body)
In this example:
The import line should be: