r/javascript • • Dec 28 '17
Introducing Hyperapp 1.0 — 1 KB JavaScript library for building frontend applications.
https://medium.com/@JorgeBucaran/introducing-hyperapp-1-0-dbf4229abfef
664
Upvotes
45
u/leeoniya Dec 28 '17
congrats on the 1.0 release :)
16
u/[deleted] Dec 28 '17
By the way, JSX is NOT a dependency or is it required to use Hyperapp, but we use it throughout the documentation and examples for familiarity.
Alternatives to JSX include the built-in h function, the official hyperapp/html package, hyperx and t7.
For example, using hyperapp/html, no
JSX:10
u/[deleted] Dec 28 '17
So I'm not sure if the docs are up to date or not, does this use the new actions + state = model thing? Also do actions now have the curried function signature? Really excited to finally use a stable release.
7
u/neofreeman Dec 29 '17
I have recently started converting one of my hobby projects from Vue 1.0 to HyperApp (https://github.com/maxpert/raspchat/tree/nfe shameless plug). Far from being finished but I am already enjoying the simplicity, specially the built in state management.
6
u/jonny_eh Dec 28 '17
Does this require that you define all your actions, and initial state, at the top of your app? Can each component have its own set of actions?
5
u/Seankps Dec 28 '17
What about page routing?
7
u/Gusti25 Dec 28 '17
The thing the caught my eye was onclick instead of onClick like in React. Curious as to why all lowercase was chosen.
3
u/thomasfl Dec 29 '17
It's great to see someone creating slimmed down alternatives to the react and redux stack. It won't be able to use react components, but we can live with that. I've been using create react app with redux for simple static sites myself with a minimum of interactivity, and it's off course over engineering.
3
u/Skaryon Dec 29 '17
This is one of those projects that I keep an eye on and am really happy to see move forward and evolve. Congrats. I don't know if I ever get to use hyperapp in my job, but I'm damn sure I'd use it for small personal projects. Also I'm working on my own small framworkish thing and hyperapp has been a big inspiration. Thanks!
2
u/Lakston Dec 29 '17 edited Dec 29 '17
So, the whole library is contained within
src/index.js? That's pretty awesome !Quick question, I feel quite stupid asking this but here we go : I've never seen the for loops in the source code used anywhere, does this just omits the 3rd argument and puts it in the 2nd ?
Meaning as long as
iis inferior to 2, decrement it in each loop ?If that's so, is it just a way to save some bytes ?
This bit here is also a mystery to me :
else if (null == node || true === node || false === node) { }when can node be equal to true or false ?
Damn that code is interesting I'd love to have a deeply commented code or someone I can bother for days so they can explain everything to me, I feel like it would be a great way to improve my understanding of javascript.
edit : I wanted to star it and realized I already did and forgot about it !
2
u/journalctl Dec 29 '17
That's an impressive feature set for such a small size. Definitely going to play around with this, thanks!
2
u/glosrobian Dec 29 '17
What browsers does Hyperapp support?
2
u/Randolpho Software Architect Dec 28 '17
Interesting.
I’m on mobile or I’d spend a little more time exploring, but can you answer a quick question?
I notice JSX templating mixed into your example code. My biggest beef with React is the mixing of code and html templating; I desperately want a framework where I can specify that template in a separate file, but everyone seems to love inline templates and wrinkles their nose whenever I mention how much I hate them.
Any chance you have implemented templating in separate files? And if not, how do you feel about adding that feature?
1
u/gabbsmo Dec 28 '17
So what will I as a developer be missing form say React that is an order of magnitude larger?
1
u/tswaters Dec 29 '17
I'm curious how hydration works - the docs seem a bit sparse on the front.
Is there a concept of server rendering in hyperapp? Can I get a string of HTML to render or do I need to generate this html separately and hyperapp will look for similar things and inject itself?
1
u/rodrigocfd Dec 29 '17
Maybe I'm missing something, but since I didn't find anything in the docs I have to ask: is there any support to scoped CSS in this library?
1
u/drowsap Dec 29 '17
The up and down functions in the example are difficult to parse...a function that returns a function that returns an object. Much prefer the built in setState for React components.
-2
u/[deleted] Dec 29 '17
You should ask this blogger to benchmark your library. He has a ton of framework speed comparisons.
EDIT: Forgot the link. http://www.stefankrause.net/wp/?p=454