To start with, I'd recommend sticking with native just to see /how/ problems are generally solved, because knowing the actual algorithm behind the tooling you're using makes debugging it way way easier. Another reason for this is that javascript, as a low-entry-requirement language is very very faddy, and the latest frontend's gonna be something no one'd heard of before, they usually have a turnover of about 3 months before someone else "solves" frontend work.
Also as a side note, an absolute requirement for javascript work is the
MDN docs. MDN is ridiculously good at documentation, to an extent I haven't really seen outside of en.cppreference.com . They're concise, explain common pitfalls, come with minimum viable code, have a history of availability in all the major browsers at the bottom, explain which features are standardised and which are just upjumped libraries that FF and Chrome but not Edge or Safari implement. A ton of good stuff that's useful.
But when you actually get to working with a frontend, my preference is for
React with
Redux, because it's one that's actually recognizable as javascript, and the
JSX Harmony language is an absolute pleasure to work with and offers a really good, nearly first-class integration with the DOM. I recommend redux along with it because
immutable's really the only way to handle data safely in javascript. It's absurdly hard to do it well without it because of stupid caveats like javascript's insane type coercion decisions or multiple null value types or prototype chain leaks or lack of datastructure ownership.
I'm not a big fan of
angular because it's one of those frameworks that basically isn't any good if you don't use any of its tooling, and locks you in to a ton of stuff. Angular's not really an extension of the language like libraries ought to be, it's pretty much more of an app you can communicate with using a bunch of typescript config files. Typescript's big advantage is that it, as the name suggests, is a typed language extension for js. Type safety's a pretty good tradeoff for having to learn a new language and use google's libraries for everything.
These are the big full conversion type frameworks, but normally integrable frameworks are also pretty popular and I prefer them over react or angular. We're using
Semantic UI in our electron app right now and it's decent. In my old company we used to use a shitton of bootstrap to do stuff too.
Bootstrap's UI components are pretty decent to look at, and make rapid development way easier.
There's also the venerable swiss army knife, the Boost of javascript, which implements a ton of clever ideas that end up in the ES standard like CSS style selectors for DOM objects,
JQuery. If you're ever working with someone else's code, there's a pretty giant chance you're gonna be looking at some core functionality js didn't provide being done with JQuery so even if it's losing steam recently because of the bigger frameworks that do more for you, it's a pretty good thing to know. Most web devs pretty much don't know how to do things that made it into the standard post-jquery and just stick to the jquery way of doing them.
Another must-have library because it fills in a giant hole in javascript's design is
Moment.js. Dates in javascript are garbage. There's no other word for them. They coerce into strings if you don't construct them with a new, unlike any other object javascript offers like strings or arrays or maps. They have wildly inconsistent formatting across browsers, you can add them and they'll concatenate as a string, while if you subtract them they turn into an unusable difference of unix timestamps. There isn't a standard formatter function like strftime, and the native way to do it is to extract all the elements one by one yourself, left pad them one by one yourself (usually with a function you write since leftpadding wasn't in the standard until last year), and concatenate them yourself. Use moment, it'll save you the headache.
- Code: Select all
>new Date() + new Date()
"Sat Mar 03 2018 01:26:04 GMT+0530 (India Standard Time)Sat Mar 03 2018 01:26:04 GMT+0530 (India Standard Time)"
>new Date() - new Date()
0
>Date() + new Date()
"Sat Mar 03 2018 01:28:02 GMT+0530 (India Standard Time)Sat Mar 03 2018 01:28:02 GMT+0530 (India Standard Time)"
>Date() - new Date()
NaN