Better HN
topnewbestaskshowjobs
Log inSign up

hyperapp

217 karma · joined Jan 30, 2017 (9y ago) · 120 submissions

Submissions

61.

Show HN: Introducing Hyperapp 1.0 – 1KB JavaScript library for building web apps(medium.com ↗)

6 points · by jbucaran · 8y ago · 2 comments

62.

Show HN: (1KB) JavaScript library for building fast and feature-rich web apps(github.com ↗)

9 points · by jbucaran · 8y ago · 4 comments

63.

Show HN: 1 KB JavaScript library for building front end apps(github.com ↗)

40 points · by jbucaran · 8y ago · discuss

comment 8y ago · link · parent

This milestone means the API has reached stability and the churn is finally over, which is one of the main reasons we haven't had time to work on the ecosystem.

comment 8y ago · link · parent

IIRC, it's the authors who get to post in "Show HN", that's the whole point of it and is what I did here.

66.

Introducing Hyperapp 1.0 – 1 KB JavaScript library for building front end apps(medium.com ↗)

13 points · by jbucaran · 8y ago · discuss

comment 9y ago · link · parent

It's being worked right now! :)

68.

Show HN: 1 KB JavaScript library for building applications(github.com ↗)

116 points · by jbucaran · 9y ago · 8 comments

69.

Show HN: Tiny (300B) and 20x faster alternative to React classNames(github.com ↗)

12 points · by jbucaran · 9y ago · discuss

70.

Show HN: The Elm Architecture in 10 LOC(gist.github.com ↗)

6 points · by jbucaran · 9y ago · discuss

comment 9y ago · link · parent

That would be so nice! I am working on a "how it works" post, but it's still not finished.

If you are interested have a look here:

https://gist.github.com/jbucaran/8dc33b7947f3193eb2ea3d5700e...

comment 9y ago · link · parent

I like and agree a lot with this definition too. Thanks!

comment 9y ago · link · parent

Looks really cool, other than Object.assign, Proxy and Symbol I think this is quite an achievement for that size, but I am pretty sure it doesn't support keyed DOM updates. Hyperapp was also under 1 KB before we introduced the keyed VDOM.

comment 9y ago · link · parent

I remember I was perhaps 17 and while I really didn't understand very well what ColdFusion was about, I wanted to try it out so badly. Unfortunately, it wasn't free, so I was never able to get do anything with it. I enjoyed AS3 to the fullest though.

comment 9y ago · link · parent

Sorry, I am sure you could use JSX with DIO.js too. To be honest, I wasn't even looking at the JSX. I grabbed it from where I found it. The takeaway is not JSX, but the fact that they use classes and that's all.

Personally, if I was going to go with this kind of architecture, I'd choose Preact (or React if I can't help it) to tap into the massive React ecosystem.

comment 9y ago · link · parent

Thanks for the comment :)

Hyperapp doesn't outperform DIO.js, but that was never the mission I embarked on with this project. You can see it benchmarked <https://rawgit.com/krausest/js-framework-benchmark/master/> among many other frameworks and you can see it's on the same ballpark as React.

The goal of this project is to minimize the concepts you need to learn to write a modern frontend app while staying on par with what other libraries can do; deliver good performance, but not at the sake of a clumsy or awkward API; reduce the boilerplate and still follow our "simplified" take on Flux or the Elm architecture if you prefer.

Hyperapp is unreservedly functional, we don't have stateful components, use `this`, classes or have more than one way to do the same thing.

We are not just about saving bytes either, but size and our brutally small code base is important for a few reasons. The idea behind the entire thing being 300 LOC is that _anyone_ can understand how everything works within a few hours. It's genuinely possible to understand not just what it does, but how it does it.

IMHO a normal person can't do that with React, or DIO, or most of the other large-ish frameworks out there. Even Preact, I found it too large for my taste. Yes, minified and gzipped is like 3.4 KB, but that translates to almost 800 LOC. It's an outstanding achievement considering it's just a fraction of React, but you are only getting React+ReactDOM.

Hyperapp is not perfect, but you are getting React+ReactDOM+Redux+ReduxThunk out of the box.

Just for a light (and harmless) comparison, this is a +/- counter in DIO.js:

    class Counter {
      getInitialState () {
        return {
          count: 0
        }
      }
      increment () {
        return {
          count: this.state.count + 1
        }
      }
      decrement () {
        return {
          count: this.state.count - 1
        }
      }
      render () {
        return [
          this.state.count,
          h('button', {onClick: this.increment}, '+'),
          h('button', {onClick: this.decrement}, '-')
        ]
      }
    }

    dio.render(Counter);

And here is the same in Hyperapp:

    app({
      state: 0,
      actions: {
        add: state => state + 1,
        sub: state => state - 1
      },
      view: (state, actions) =>
        <div>
          <button onclick={actions.add}>+</button>
          <h1>{state}</h1>
          <button onclick={actions.sub}>-</button>
        </div>
    })

comment 9y ago · link · parent

Thanks! Here is the release notes page of the last dozen of versions for now.

https://github.com/hyperapp/hyperapp/releases

comment 9y ago · link · parent

We've come a long way since then. We are super close to 1.0 now and while the API hasn't changed much, there have been numerous breaking changes and we've also added new features, documentation, examples and seen the ecosystem grow too.

comment 9y ago · link · parent

It's called JSX. I used it in the example because it's popular among the JavaScript crowd, popularized by React.

That code is not directly consumed by the browser, instead, it's compiled into the code below by a compiler like Babel, minified and bundled into a tiny blob of code we ship to the browser.

    app({
      state: {
        count: 0
      },
      view: (state, actions) =>
        h("main", {}, [
          h("h1", {}, [state.count]),
          h("button", { onclick: actions.down }, "-"),
          h("button", { onclick: actions.up }, "+"),
        ]),
      actions: {
        down: state => ({ count: state.count - 1 }),
        up: state => ({ count: state.count + 1 })
      }
    })
So, I used JSX for "familiarity", but you don't need to use it to build your own apps. You can just write the code shown in the snippet above and you'd do just as well. You can also minimize and bundle your code to tap into the JavaScript ecosystem, code using a modular style and still not have to use JSX at all.

Hope that helps :)

80.

Show HN: 1 KB JavaScript framework for building front-end applications(github.com ↗)

216 points · by jbucaran · 9y ago · 42 comments

81.

Show HN: Tiny (320B) JavaScript function for conditionally concatenating class names(github.com ↗)

5 points · by jbucaran · 9y ago · discuss

82.

Show HN: 1 KB JavaScript library for building front end apps(github.com ↗)

242 points · by jbucaran · 9y ago · 2 comments

83.

A tiny Node.js dependency installer(github.com ↗)

5 points · by jbucaran · 9y ago · 1 comment

comment 9y ago · link · parent

Diff and patch does happen via a virtual DOM, which is included in the source code. State management is also built-in.

comment 9y ago · link · parent

Check out: https://github.com/picodom/picodom

86.

Show HN: Hyperapp – 1 KB JavaScript library for building front end apps(github.com ↗)

69 points · by jbucaran · 9y ago · 7 comments

87.

Show HN: HyperApp on CodePen. HyperApp Is a JavaScript Library Inspired by Elm and Redux(codepen.io ↗)

1 points · by jbucaran · 9y ago · discuss

1234