News for hackers. Stuff that matters.
Re:The Case for React-Like Web Components by pjmlp on Thursday February 01, 2018 @09:28AM (#16282039)
Quite true, I also prefer Vanilla JS and look forward to Web Components becoming more mainstream.

The pure Web stack skills stay, while framework specific skills are only good until the next JS Framework hype cycle.

Where are Dojo, MooTools, YUI, Promise.js now?

In a couple of years React, Angular, Vue, Polymer might join them, but VanilaJS, HTML, CSS skills will stay relevant.

Re:The Case for React-Like Web Components by chatmasta on Thursday February 01, 2018 @09:37AM (#16282092)
You can learn React in a day. The API is composed of less than ten functions.

To answer part of your question, Promise.js has become formalized in the ECMAScript standard, so maybe not the best example.

These frameworks emerge to make it convenient to solve problems that JS does not offer an easy way to solve. I don’t see anything philosophically wrong with that; in fact, I would argue it’s a big driver of JS adoption. Prototypical inheritance makes it very easy to bend javascript to your will.

If you don’t like the frameworks you don’t need to use them, but it’s going to harm your career if you actively avoid learning how to use frameworks that are deployed with increasing frequency on new projects.

The other advantage of frameworks is that they provide common idioms and enforce procedural standards, both of which make working on a team more productive as everyone has the same base of understanding. They also make it easier to hire for that team.

Try implementing any sufficiently complex app in vanilla JS and you’ll likely end up recreating many of the aspects of popular frameworks, except your “internal framework” will be messy, undocumented, and unique to your project, severely reducing maintainability and increasing onboarding time of new developers.

Re:The Case for React-Like Web Components by meesterdude on Thursday February 01, 2018 @09:41AM (#16282115)
> You can learn React in a day.

Maybe React itself, but everything else that goes into doing react development; design patterns, gotchas, testing, webpack, native and so on? That takes far longer than a day, and is what most would expect when being able to really say they "know react".

Re:The Case for React-Like Web Components by chatmasta on Thursday February 01, 2018 @09:45AM (#16282138)
Agreed, but as I mentioned in my edits of the comment, you’ll likely end up needing to solve all these problems in vanilla JS as well. So it’s really a question of picking your poison.

Also, many of the concepts you need to learn for proficient react development are auxiliary to react and could be applied to vanilla JS or really any UI framework. Any UI is fundamentally a state machine, and solutions to implementing it all require state management and clean separation of the presentation and data layers.

Re:The Case for React-Like Web Components by dmitriid on Thursday February 01, 2018 @10:28AM (#16282478)
Yeah, and how WebComponents are gonna help with that? Considering that you need all of that just to make them marginally useful.
Re:The Case for React-Like Web Components by dictum on Thursday February 01, 2018 @10:05AM (#16282300)
I don't want to turn this into another misguided "JS sucks" thread[0], but here's an example from create-react-app, the official point of entry for people learning React:

https://github.com/facebook/create-react-app/blob/master/pac...

The README included on a project generated through CRA is 116KB. A screenshot of that page rendered in GitHub is 60054px tall.

Honestly, I don't know if this could be made simpler or easier. React and its ecosystem deal with complex problems that can't always be reduced to simple explanations. In the case of this README, of course a lot of it is about specific setups that most beginners don't need to care about, but that CRA, being the blessed point of entry, still should support, or it would lock everyone into a Facebook workflow.

I think many developers would be better served by entering frontend development not through React, but through the basics (HTML, CSS, JS) and other ecosystems.

[0]: Unrequested opinion: frontend developers reach for bigCo solutions — whatever Facebook/Google/some billion-dollar startup uses — when smaller, lesser known, "boring" or exploratory solutions could be better, trying to solve problems they don't have.

Re:The Case for React-Like Web Components by symlinkk on Thursday February 01, 2018 @10:12AM (#16282347)
That's not the official point of entry, the main React site is: https://reactjs.org/docs/hello-world.html
Re:The Case for React-Like Web Components by dictum on Thursday February 01, 2018 @10:42AM (#16282599)
Good point. What I meant by "point of entry" wasn't the way to learn React as an absolute beginner, but the official tool to use after you've learned the basics of React itself. A beginner can (and should) go far without a build system.
Re:The Case for React-Like Web Components by tboyd47 on Thursday February 01, 2018 @09:51AM (#16282178)
> They also make it easier to hire for that team.

At my last company, we found the opposite to be true. Switching to React made hiring all but impossible. Our Ruby devs mostly refused to learn the new stack and left, and most of the people we did hire to replace them were Java developers. I only met one hire who was immediately productive on our stack and she said it's because she had spent the past few months learning programming for 70 hours a week (!). She left 3 weeks later for a better paying job. Front-end development is absolutely bonkers right now.

Re:The Case for React-Like Web Components by pjmlp on Thursday February 01, 2018 @10:27AM (#16282471)
I have been developing software for about 30 years, following the latest hype is not always the best to one's career.

For example, I am glad I did not spend more than a few minutes looking at Coffescript.

Re:The Case for React-Like Web Components by petilon on Thursday February 01, 2018 @11:15AM (#16282978)
>> You can learn React in a day.

You can't build an application using React alone. You also need to learn ReactRouter and Redux, which add lots of complexity. Not to mention, if you spent only one day learning React you're probably going to do it wrong: you have to learn things like where to put state, when you have a hierarchy of components. Learning the "ten functions" of the API isn't enough!

Re:The Case for React-Like Web Components by GrumpyNl on Thursday February 01, 2018 @09:44AM (#16282135)
How and where can you learn react in a day? Thats the problem in the real world, you can learn about react within a day, you need more and lots more time to master react and all that comes with it.
Re:The Case for React-Like Web Components by macspoofing on Thursday February 01, 2018 @09:36AM (#16282086)
Yes. The right answer is to fix JavaScript so it doesn't need 5000 frameworks that have their own spin on how to organize code.
Re:The Case for React-Like Web Components by Rbatista on Thursday February 01, 2018 @09:46AM (#16282143)
fix javascript.. lol.. what makes js one of the most used languages is it's crazyness.
Re:The Case for React-Like Web Components by krapp on Thursday February 01, 2018 @09:59AM (#16282244)
>what makes js one of the most used languages is it's crazyness

No.. it's ubiquity in the browser alone made it one of the most used languages. Obviously, when there is only one game in town, that game is going to be popular.

People hate javascript and its "crazyness" so much that the entire universe of modern web development was designed around using other languages which "compile" to it so that developers could avoid direct contact with it as much as possible. What other language gets treated like a contagion by its own users?

Re:The Case for React-Like Web Components by Gaelan on Thursday February 01, 2018 @11:24AM (#16283065)
Assembly?
Re:The Case for React-Like Web Components by macspoofing on Thursday February 01, 2018 @10:03AM (#16282281)
If Brainfuck was included in browsers it would be 'one of the most used languages'.
Re:The Case for React-Like Web Components by matt4077 on Thursday February 01, 2018 @09:40AM (#16282106)
These "React is just this month's JS Framework Hype" comments are really starting to look silly, considering React is coming up on 5 years.

And it's not like "Vanilla JS" isn't a moving target itself.

Re:The Case for React-Like Web Components by sebringj on Thursday February 01, 2018 @10:53AM (#16282725)
I think its easier to say that because of the past history of moving targets with JS. The "aha" moment you get with React is it abstracts things in a very easy to understand way with JSX at its heart. You then find it quite easy to move from React Web to React Native to React VR or whatever other thing they cook up because its just simple to look at abstraction without the hairy object boilerplate that you are normally subjected to.

Maybe React itself is just another flavor but the JSX paradigm is really the goodness I think more frameworks could use which cough cough was done by Microsoft a long time ago.

Re:The Case for React-Like Web Components by pjmlp on Thursday February 01, 2018 @01:12PM (#16284149)
Vanila JS is part of the browser stack, a bit like UNIX and C, Java and JVM, CLR and C#, iOS and Objective-C/Swift, Android and Java,....

Those who master the platform win, regardless of flavour of the month Framework that one puts on top of it.

Re:The Case for React-Like Web Components by cdurth on Thursday February 01, 2018 @10:23AM (#16282431)
Very silly. If you are keeping up with the latest and greatest in JS, you have the 20 minutes to sit down and learn the basics of a framework that will make your life a bit easier. This argument will never end, code hipsters need their voices heard.
Re:The Case for React-Like Web Components by rvanmil on Thursday February 01, 2018 @09:49AM (#16282158)
Afaict vanilla js these days is much less relevant than any of the current frameworks. Is it really that big of a deal to learn a new framework/library every now and then? They're really not that hard to learn and the productivity boost is definitely worth the investment. Hype is not at all the reason they're popular.
Re:The Case for React-Like Web Components by DougWebb on Thursday February 01, 2018 @09:53AM (#16282193)
The problem isn't learning the frameworks; the problem is creating code that relies on them and has to be supported for years, which may or may not be longer than the active lifespan of the framework.
Re:The Case for React-Like Web Components by Vinnl on Thursday February 01, 2018 @11:45AM (#16283283)
Regardless of whether web components would actually be a stand-in for things like React: what makes you think that integrating something in the language results in it being there to stay? If Angular 1's two-way data binding had been added to HTML proper, I'd still have moved on to a virtual DOM-based approach.
Re:The Case for React-Like Web Components by bobbby on Thursday February 01, 2018 @11:15AM (#16282973)
VanillaJS and CSS have changed far more than React in the last few years. ES6 and CSS grids alone brought massive changes.
Re:The Case for React-Like Web Components by pjmlp on Thursday February 01, 2018 @01:08PM (#16284109)
They aren't going anywhere, they are part of the browser stack. Now React, well lets seen in 5 years time.