Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

NueJS: “It’s just HTML!”

The HTML: <button @click=“count++”> {count} </button>



Please read the whole sentence. It starts with: If React is “Just JavaScript, then...” React users often say that "It's just JavaScript" but then they write:

  return (
    <div>
      <h2>You clicked {count} times!</h2>
      <button onClick={() => setCount(count - 1)}>
        Decrement
      </button>
      <button onClick={() => setCount(count + 1)}>
        Increment
      </button>
    </div>
  )
Nue is the opposite side of the same coin.


> If React is “Just JavaScript, then...”

React is just JavaScript. React+JSX is JSX. This:

  <button onClick={() => setCount(count + 1)}>{count}</button>
Is sugar for:

  React.createElement('button', { onClick: () => setCount(count + 1) }, count)
True, the JSX version is most popular, but it's trivial syntax sugar with no "magic." This is different then Angular, Vue, Svelte, etc templates


isn't that just syntax sugar? I believe it compiles into (for some el function and safe string tag)

    return el("div", { children: [
      el("h2", { children: [safe`You clicked ${count} times!`]) },
      el("button", { onClick: () => setCount(count - 1), children: [safe`Decrement`] }),
      el("button", { onClick: () => setCount(count + 1), children: [safe`Increment`] })
    ]}); 
The "it's just javascript" part comes from having no hidden getters, setters or proxies littered in code that may or may not behave as how we expect, and not littering the html with react-specific attributes for iteration, events, etc


It surely is. React is a good pick for frontend engineers who prefer to use JavaScript or TypeScript. Nue is designed for UX engineers, who prefer a HTML- like syntax for defining the structure & layout.


Do people generally say React is “just JavaScript”? I’ve seen it said about Svelte, never React.

In any case, why market your framework with an equally poor comparison?


Yes people say that, and it is 100% true.

You can use all React features without any special tooling.




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

Search: