Closed pakastin closed 8 years ago
I have though about changing el(tagName) to return view instead of HTMLElement. Then you could do:
el(tagName)
js class Hello { constructor () { this.el = el('h1') } update (data) { this.el.setStyle('color', data.color); this.el.setClass('bold', data.bold); } }
or even:
function Hello () { var view = el('h1'); view.update = data => { view.setStyle('color', data.color); view.setClass('bold', data.bold); } return view; }
This would actually be preferred style. It's not class anymore, but you should uppercase it because of JSX:
<Hello></Hello>
Thoughts?
I'm also studying custom HTML elements, and how you could benefit from them..
..closing for now
I have though about changing
el(tagName)
to return view instead of HTMLElement. Then you could do:or even:
This would actually be preferred style. It's not class anymore, but you should uppercase it because of JSX: