News for hackers. Stuff that matters.
Re:Learn React by building a web app by combatentropy on Tuesday April 10, 2018 @06:13PM (#16806023)
Re:Learn React by building a web app by exodust on Wednesday April 11, 2018 @01:28AM (#16808302)
The left column of that site only confirms (for me) how much friendlier Jquery is and that I don't want to give it up.
Re:Learn React by building a web app by technion on Wednesday April 11, 2018 @03:33AM (#16808848)
The site only goes to IE10 though.

The first three examples, which are probably the worst, improve greatly in more modern browsers that include the fetch() API.

In my view even the jQuery examples look a lot better if you can write ES6.

Re:Learn React by building a web app by chrisan on Wednesday April 11, 2018 @05:44AM (#16809481)
The first example is not really apples to apples as it doesn't even have error handling which makes the native function look longer. Probably because getJson doesnt support errors by default and you have to use promises http://api.jquery.com/jquery.getjson/

I ran into this issue of jquery silently failing a while ago and will always remember that pain point

Re:Learn React by building a web app by exodust on Wednesday April 11, 2018 @08:47AM (#16810533)
I don't think I've ever used getJSON(), only ever the longer form ajax(), and never had issues with error handling, well at least since jquery 1.9 when deferred promises came good. Using .then() to chain events together is very smooth, what I always wanted. I'm lightweight with JS mostly though!
Re:Learn React by building a web app by sakarisson on Wednesday April 11, 2018 @02:41AM (#16808616)
The first time I saw that site, I assumed it was a joke. Seems more to me like it's trying to tell people how nice jQuery is. Who would look at that and walk away with the opinion that jQuery is unnecessary?
Re:Learn React by building a web app by ForHackernews on Wednesday April 11, 2018 @04:49AM (#16809211)
The idea is that if you're building your own Javascript library, you can avoid the huge dependency of jQuery.

If you're developing a user-facing app, then yeah, jQuery is still pretty darn helpful.

Re:Learn React by building a web app by 12312313 on Wednesday April 11, 2018 @09:10AM (#16810718)
Its 85kb. I wouldn't say its a huge dependency. I rather keep it than having to learn an entirely new framework.
Re:Learn React by building a web app by kaishiro on Wednesday April 11, 2018 @09:12AM (#16810734)
Are you referring to vanilla JS as an entirely new framework?
Re:Learn React by building a web app by 12312313 on Wednesday April 11, 2018 @09:19AM (#16810784)
No, of course not. Vanilla JS is a scripting language. I was referring to React.
Re:Learn React by building a web app by reacweb on Wednesday April 11, 2018 @03:54AM (#16808941)
I think it is unopinionated. I like it very much because it teaches how to do things in plain javascript.
Re:Learn React by building a web app by combatentropy on Wednesday April 11, 2018 @10:51AM (#16811618)
jQuery is still great for web applications.

The site suggests you try not to make it a dependency if you're writing a JavaScript library. I also suggest vanilla JavaScript for simple pages that need just a smattering of interactivity.

Re:Learn React by building a web app by forgotmypw on Wednesday April 11, 2018 @04:21AM (#16809070)
Maybe the next step is a utility that "recompiles" or "statically links" jQuery JS into plain JS?