Hacker News new | past | comments | ask | show | jobs | submit login

Mithril was doing this exact thing before React became big - it's what we're moving away from (with JSX), not where we're heading.



I wouldn't necessarily say we're moving one way or another. React technically released before Mithril. It just so happens React became more popular and JSX is idiomatic in React. But hyperscript is usually compatible w/ JSX (in fact, in Mithril you can choose whether you want to use JSX or hyperscript)

Personally, I think indentation w/ hyperscript tends to look more natural for large sets of props, e.g.

    h('div', {
      id: 'hello',
      title: 'hello'
      onclick: () => {
        console.log('hello')
      },
    }, [
      // hi
      'hello'
    ])

    // vs

    <div
      id="hello"
      title="hello"
      onclick={() => {
        console.log('hello')
      }}      
    >
      {/*hi*/}
      hello
    </div>
With Mithril's variety of hyperscript in particular there are also some other neat features, such as the ability to pass css selectors as the first argument, e.g. `h('input[type=password].password')` or `const TailwindComponent = '.rounded-lg.md:w-56'; const element = <TailwindComponent />`.


Many projects still predominantly use Hyperscript with the option to use JSX (including Mithril and Hyperapp, and others like RE:DOM, snabbdom to name a few). Even React has an option to use it if you want to skip the JSX compile-step. So I wouldn't say we're necessarily moving away from it.

Personally, I prefer Hyperscript. It took maybe a day for me to get over its perceived ugliness and actually appreciate that it's plain, valid JavaScript.


Going back to PHP and ASP you mean.


Hay! There is some power in being able to bang out a page with <h1>Hello <?php echo "World"; ?></h1>


Agreed, the problem is when that page gets to a book size.


That's why there are components that you put together, so that no one component is very large.


Text templates are the technology for web development. They are so much better than anything else that there's no comparison.

There are some bad templates implementation, and some good ones. The original PHP and ASP are bad. But that doesn't mean templates are bad.


Text templates are a good idea, placing them into the middle of JavaScript code, not really.


I absolutely disagree, but I also feel it's unfortunate that HTML, CSS, and SQL aren't first-class citizens in most languages. It's strange to treat things backed by entire standards bodies and with fully developed ASTs as plain-text.

It seems unnecessarily limiting, and I'm not sure why; For the sake of history? "Division of Concerns"? How is it that using libraries meant for string manipulation upon a standardized format not a concern in and of itself?

The reason JSX, Mithril, PHP's template tags, ASP, Mustache, Twig, etc, exist is because we want to generate HTML - a language that has been standardized for decades - so why are we still playing around with string manipulation tools?


It's an evolutionary constraint. Text templates are initially much more useful than HTML and CSS ones, so people adopt the first, despite a bigger potential usefulness of the later.

The tendency for SQL is even weirder, it's for replacing it with languages that are much less useful for querying data.


We aren't, only those that keep fighting against MVC, HTML Templates and Web Components are.


I do agree with that. But on the case of JSX, it is located inside JS code, but is completely self-contained, thus, it's not as bad.

The original PHP and ASP are really singular beasts, people aren't creating things like those anymore.


What do you consider some of the good ones?


*improving on PHP and ASP


With thing like GraphQL, I get a definite ColdFusion vibe, too.


Worth noting that ColdFusion actually did components before it was cool :-) (I don't mean ColdFusion components which are really just classes in .cfc files, but custom tags which let you write custom markup)

    <cf_menu position="left">
      <cf_menu_item current="true" label="Home" url="/"/>
      <cf_menu_item label="Accounts" url="/accounts" />
    </cf_menu>


We are definitely in ColdFusion territory:

https://github.com/seancoyne/awesome-coldfusion#application-...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: