Live data from Hacker News

Show HN: 1 KB JavaScript framework for building front-end applications

github.com

1–10 of 44 posts

Re: Show HN: 1 KB JavaScript framework for building front-end applications

#3

I want to see the trend of maximal libraries in javascript now. Show HN: 2 MB JavaScript library for building front end applications with a lot of useful interactive ui components. like https://github.com/nlp-compromise/compromise

Don't think that will catch on ;)

Re: Show HN: 1 KB JavaScript framework for building front-end applications

#6
post #4

So I'm looking at the example JS snippet and suddenly it embeds HTML in the middle. Can someone who knows current JS explain how this even parses?

What you are looking at is called JSX[1]. It's not valid JavaScript, but is turned into function calls by transpilers such as Babel[2]. It's used as a more HTML-like syntax of writing function calls that output a representation of the DOM known as a "virtual DOM". You can embed JavaScript inside of JSX by using single curlies.

[1] https://facebook.github.io/jsx/

[2] http://babeljs.io/

Re: Show HN: 1 KB JavaScript framework for building front-end applications

#7
post #4

So I'm looking at the example JS snippet and suddenly it embeds HTML in the middle. Can someone who knows current JS explain how this even parses?

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 :)

Re: Show HN: 1 KB JavaScript framework for building front-end applications

#9
post #8

Dupe: https://news.ycombinator.com/item?id=14629414

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.

Re: Show HN: 1 KB JavaScript framework for building front-end applications

#10

I want to see the trend of maximal libraries in javascript now. Show HN: 2 MB JavaScript library for building front end applications with a lot of useful interactive ui components. like https://github.com/nlp-compromise/compromise

I agree.

The fight for really small frameworks is most relevant for consumer apps, especially ones consumed on mobile.

But even on mobile, it's primarily relevant because customers get minimal value from your app or are bad at accurately assessing the value they get.

In my day job, I work on a system where business users spend several hours a day using it. Loading a MB of minified JS has such a limited effect on the overall time it takes users to get their work done, it's almost irrelevant. Though, per the point about accuracy above, I wonder how it affects our demos.

Post reply on HN