Live data from Hacker News

Hyperapp – A tiny framework for building web interfaces

hyperapp.dev

41–50 of 198 posts

Re: Hyperapp – A tiny framework for building web interfaces

#41

Earlier quoted context omitted.

Wasn't the unwieldiness of render functions the entire reason JSX was created?

Not sure of the reason, but it's a godsend comparatively. The reaction against JSX I find to be largely by people who've never actually used it. If you keep your components small, as is best practice, whatever gut reaction one feels to it (which IMO is misplaced to begin with) is minimized, and quite readable.

My big issue with JSX is that it forces you to use a pre-processor and source maps.

If you have to do that anyway, I think I could use JSX instead of "pure" JS.

Re: Hyperapp – A tiny framework for building web interfaces

#42

In the tutorial it says: "In this tutorial we'll stick with `h` to keep it simple and close to the metal." I'm pretty sure they put that in there just to aggravate the HN crowd.

The `h` function isn't too bad to read if you keep small/manageable components. Obviously, any component, whether JSX or something else, with enough content in it, becomes quite hard to read.

Personally, I like using `h` over JSX - JSX can be nice to read, but for people that don't know how it works behind the scenes, it makes things look like magic.

Once you know how Hyperapp works behind the scenes, it's much easier to make the decision to JSX if that's something you care about when developing. I have the same opinion about React, and other libraries that have a strong preference to JSX over their native/function implementations.

Re: Hyperapp – A tiny framework for building web interfaces

#43

Earlier quoted context omitted.

Wasn't the unwieldiness of render functions the entire reason JSX was created?

Not sure of the reason, but it's a godsend comparatively. The reaction against JSX I find to be largely by people who've never actually used it. If you keep your components small, as is best practice, whatever gut reaction one feels to it (which IMO is misplaced to begin with) is minimized, and quite readable.

If you keep your components small, then using this `h` function instead of JSX doesn't make a lot of difference from readability perspective.

Also, don't forget that `h` is just a function, so nothing prevents you from creating your convenience functions, which allow more concise/readable code, eg:

const div = (...args) => h("div", ...args) const span = (...args) => h("span", ...args)

(or something along those lines)

I've experimented with this approach before (in ClojureScript) and you can get pretty far with it:

https://github.com/enumatech/cljs-abi-viewer/blob/state-chan...

In fact the Hoplon (https://hoplon.io/) framework as already doing this many years ago, even just using the DOM directly.

Re: Hyperapp – A tiny framework for building web interfaces

#45
post #29

Earlier quoted context omitted.

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.

Going back to PHP and ASP you mean.

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

Re: Hyperapp – A tiny framework for building web interfaces

#46
post #29

Earlier quoted context omitted.

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.

Going back to PHP and ASP you mean.

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.

Re: Hyperapp – A tiny framework for building web interfaces

#47
post #20

Haven't been using react because of the JSX, but is this really where we are heading? https://hyperapp.dev/tutorial#rendering-to-the-dom Looks like som obfuscated JS-code..

JSX evaluates to code that looks like that anyway. Not sure why we’d want to go backward on this front.

Re: Hyperapp – A tiny framework for building web interfaces

#49

Earlier quoted context omitted.

Wasn't the unwieldiness of render functions the entire reason JSX was created?

Not sure of the reason, but it's a godsend comparatively. The reaction against JSX I find to be largely by people who've never actually used it. If you keep your components small, as is best practice, whatever gut reaction one feels to it (which IMO is misplaced to begin with) is minimized, and quite readable.

ah, and the article also mentioned https://github.com/developit/htm which pretty much provides what JSX does, just in a lot less complex way (at the cost of a little run-time)

Re: Hyperapp – A tiny framework for building web interfaces

#50
post #29

Earlier quoted context omitted.

Going back to PHP and ASP you mean.

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.
Post reply on HN