News for hackers. Stuff that matters.
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.