News for hackers. Stuff that matters.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by chubot on Thursday January 07, 2021 @06:35PM (#25679186)
How does it compare with Preact?

https://preactjs.com/

I tried Preact a few weeks ago and the examples all worked, which was nice. And there's no build step -- you can develop with a CDN and hit F5. Big win IMO.

https://news.ycombinator.com/item?id=25391077

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by defx on Thursday January 07, 2021 @06:50PM (#25679349)
Preact is a really great project! I contributed to this myself in a very small way last year to add support for customised built-in elements. I would definitely recommend Preact if you're a fan of React. Synergy is different in a few ways, for example it uses Custom Elements whereas Preact has its own component system just like React. Synergy also separates HTML and JS concerns more clearly, making it a little more like Vue in that respect. Preact and Synergy both share this ability to work "as is" directly from a CDN without any heavy toolchain.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by tekstar on Thursday January 07, 2021 @08:19PM (#25680165)
I use Preact. I like it a lot. Started with pure ES6, Preact, and htm templates - no transpilation step! As the project got bigger I migrated to Typescript and start using it's built-in JSX compiler. Was a pretty easy step. My only package dependencies for a long time were preact and preact-router. Recently moved to webpack to support proper packaging of node modules when I moved from REST to GraphQL. But no babel, and it's been really nice to slowly increment the build complexity only when it's been needed.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by chrisweekly on Thursday January 07, 2021 @06:39PM (#25679233)
Preact is (or was at one time) a nearly-complete implementation of React's APIs -- meaning a virtual DOM, etc. Synergy takes its own approach, and uses Custom Elements (from the "Web Components" standard).

Edit: and synergy is also optionally avlbl via CDN for the no-tooling approach you liked in your preact experiments.

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by quaffapint on Thursday January 07, 2021 @08:00PM (#25679968)
I'm using Preact now in building a widget to be used on third party sites. I didn't want the heft of react, but yet that is what I knew well. Enter Preact. It has been fantastic. I've basically used all my react knowledge without any of the weight of React. Kudos to the Preact team.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by developit on Friday January 08, 2021 @10:38AM (#25685714)
<3
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by docuru on Thursday January 07, 2021 @06:58PM (#25679426)
> And there's no build step -- you can develop with a CDN and hit F5

Same with React. There is a production CDN https://reactjs.org/docs/cdn-links.html

Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by afavour on Thursday January 07, 2021 @07:14PM (#25679555)
Not totally the same as React as you still need to transpile JSX in most scenarios. I suspect that’s what they’re getting at.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by tayo42 on Thursday January 07, 2021 @09:17PM (#25680648)
You can write react without building or jsx, it's in their tutorial or getting started doc.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by afavour on Thursday January 07, 2021 @09:45PM (#25680884)
That's why I said "in most scenarios". Every React codebase I've ever worked in has used JSX.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by capableweb on Friday January 08, 2021 @06:18AM (#25683539)
Just because "Every React codebase I've ever worked in has used JSX" doesn't mean "you still need to transpile JSX in most scenarios". Of course, if you're serious about using React, doing the transpilation before pushing your code to the CDN probably makes the most sense, rather than doing the transpilation client-side or using vanilla JS. But just because it's common, doesn't mean you need to follow that way of doing things.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by afavour on Friday January 08, 2021 @01:54PM (#25688451)
You just admitted that "it's common". That's another way of saying "in most scenarios". I don't know why you're splitting hairs like this.
Re:Show HN: I built a 4kb alternative to React, Vue, etc for... by docuru on Thursday January 07, 2021 @07:24PM (#25679624)
Ah, then it's similar to Vue (for that particular feature)