4 ms·
argh.. I hate the style of mixing JS with markup language....
by jordache 10y ago
argh.. I hate the style of mixing JS with markup language....
- intrasight 10y agoAgreed. Please tell me there's another syntax for this. Please don't tell me that we're stuck with this sad relic of the past.
- dcre 10y agoThere is. You can write regular function calls like this: React.createElement('h1', {}, 'Hello') Personally I like JSX a lot, but you don't have to use it.
- kasbah 10y agoI prefer: h1('Hello') https://github.com/Jador/react-hyperscript-helpers https://github.com/Jador/react-hyperscript-helpers
- aljones 10y agoWell its actually function calls that look like markup language. Which is why you can write the function calls yourself if you hate it.
- doublerebel 10y agoMe too, so last week I created gulp-pug-hyperscript to compile Pug/Jade templates to Hyperscript [1]. In order to completely avoid JS in the markup, event binding must be done outside of the markup. I do this by using event delegation rather than binding directly to elements. [1]: https://github.com/nextorigin/gulp-pug-hyperscript https://github.com/nextorigin/gulp-pug-hyperscript