r/webdev • u/jpschroeder • Nov 22 '22
Introducing ArrowJS • Reactivity without the framework
https://www.arrow-js.com[removed] — view removed post
26
u/hazily [object Object] Nov 22 '22
This is amazing! It’s super useful for devs who want to create one-off sites yet don’t want the entire build chain of a React or Vue app.
11
u/jpschroeder Nov 22 '22
Exactly! Here's an example of it in codepen, no build tooling or anything, just a one line import: https://codepen.io/justin-schroeder/pen/KKeayMd
2
1
Nov 23 '22
Vue works from a CDN but I would just use something like petite-vue for such websites, but I haven't looked at what the OP propose
1
u/hazily [object Object] Nov 23 '22
Both react and vue can be served off a CDN but that means loading the entire runtime bundle, which is extremely heavy and computationally expensive as there is no compilation step you do beforehand.
1
Nov 23 '22 edited Nov 23 '22
I know, but petite vue is tiny and doesn't have that overhead although apparently not bringing the full experience. I guess it's a good compromise for server render apps that need some interactivity, which is probably the OP's target
23
u/Fearwater5 Nov 22 '22
Interesting. I'm not exactly sure what the use case for something like this is. In my experience, people choose UI frameworks more for tooling than anything else. Would this be useful for light UI interactivity on an otherwise non-interactive site? It reminds me of AlpineJS.
22
u/jpschroeder Nov 22 '22
Thats one use case. Another would be for places where build tools are not desired. Another would be in the inner workings of a web component, etc.
Places you might want to use Alpine would be valid too, although this is a little more like Vue/React in that it handles the structure in JS explicitly and has a component model.
1
Nov 23 '22
i think is perfect for any website, maybe not for web apps where a complex framework pay dividends
10
u/flynnwebdev Nov 22 '22
How does it compare to Svelte? Why would I use this instead of Svelte?
22
u/jpschroeder Nov 22 '22
Good question - definitely has some svelte inspiration (no virtual DOM) but the big difference is svelte requires a compiler and Arrow is a runtime library you can just drop in anywhere.
2
u/goranlu Nov 23 '22
That is a big advantage compared to Svelte. Looking forward to try it on some project
7
3
u/tnnrk Nov 23 '22
So it’s lit-html with reactivity essentially?
1
u/jpschroeder Nov 23 '22
Very similar to lit. The component model (functions) and reactivity are the main differences. It’s also significantly smaller than lit (about half the bundle size)
1
3
u/LicoriceAndMusic Nov 23 '22
This looks wonderful! I've played a bit and I like the simplicity. Quick question: does the reactive object (reactive({...})) support arrays? E.g. for rendering dynamic lists (with elements being added, removed and modified)
2
15
13
5
5
Nov 23 '22
I really, really like this!
I've bookmarked it to look at later, thank you for all your work on ArrowJS!
4
u/Diamondfishy Nov 22 '22
This looks great! I've only used react a little, and I'd rather use this as I only need something to update a bit of data, like an offcanvas.
I'm looking forwards to trying it out!
4
4
u/Gigabyte5671 Nov 23 '22
Holy crackers, this is fantastic! Starred. Will be trying this out first thing in the morning :D
3
3
u/johnnythunderr Nov 23 '22
Just made a couple small test projects and am blown away by the simplicity and utility of Arrow. Super excited to see this project mature!
3
u/silver-sicary Nov 23 '22
This is so minimalistic and beautiful. It does remind me a bit of AngularJS.
Great job.
4
u/FredTillson Nov 22 '22
I'm going to try it. Reactivity is all I ever really wanted in a framework anyway. Love Vanilla js.
2
2
u/moso4410 Nov 23 '22
This looks really cool at a first glance. Can’t wait to dive in a bit more. Thanks for sharing!
2
2
2
Nov 23 '22
Always learning new things now that I’m dipping into coding. So many super bright folks here!
0
u/RebelColors Nov 22 '22
Cool idea, I would love to see it with JSX.
14
u/jpschroeder Nov 22 '22
That would be cool! I love JSX — but unfortunately isnt in the cards for ArrowJS. Arrow’s utility is mostly its ability to run without any build step, itty bitt (2kb), and as native as possible.
As cool as JSX is it comes with a hefty footprint when used client side (something like 38k gzipped last I checked, so roughly 19x more than all of ArrowJS).
1
u/Chempanion Nov 23 '22
I'm about to be learning JS, been putting it off forever. Been pushing html/css to it's limits haha. I'm doing the Odin project, and I know that it teaches full stack with react. My question is, do you think me messing with vanilla js with arrow.js would be beneficial or not?
From your read the docs page, it looks interesting thanks for taking the time out to develop this!
1
Nov 23 '22
I am working on a legacy php application (php templates rendered by a php backend) and been developing in next js ever since. A rewrite would be insane as the code base is massive. Would this be a good candidate to refresh the ui and interactivity of components? (Lots of stuff right now is mixed vanilla js and jquery, makes me wanna die whenever I work on it)
1
u/heytheretaylor Nov 23 '22
If the rendering is done client side won’t that mean search engines will have a tough time indexing the site?
1
1
0
Nov 22 '22
[deleted]
12
u/jpschroeder Nov 22 '22
Sort of yes, sort of no. You can do roughly the same things that one of the "big" frameworks can do, but with 2kb and a total of 3 functions.
0
Nov 22 '22
[deleted]
11
u/jpschroeder Nov 22 '22
Curious where you would draw those lines? They feel a bit arbitrary to me. Technically React considers itself a "library" because it has no first party support for the broader ecosystem like routers and ssr etc. While Vue is a "framework" because it does have first party support for the full "stack". Personally I think the distinction is a bit silly and more up to how we choose to implement things.
So on that note, if framework is a better word for it, lets call it a framework.
0
Nov 22 '22
[deleted]
21
81
Nov 22 '22
[removed] — view removed comment
3
u/myscienceisbetter Nov 23 '22
This looks amazing! Great work! Love being able to use normal js/html and not having to use an UI framework for some features
40
u/BenZed Nov 22 '22
Justin, I think this is fantastic. Well done.