News for hackers. Stuff that matters.
Re:React v15.5.0 by STRML on Friday April 07, 2017 @08:09PM (#14064440)
This is a big deal to deprecate `createClass` and `propTypes`.

PropTypes' deprecation is not difficult to handle, but the removal of createClass means one of two things for library maintainers:

(1). They'll depend on the `create-class` shim package, or,

(2). They must now depend on an entire babel toolchain to ensure that their classes can run in ES5 environments, which is the de-facto environment that npm modules export for.

I'm concerned about (2). While we are probably due for another major shift in what npm modules export and what our new minimum browser compatibility is, the simple truth is that most authors expect to be able to skip babel transcompilation on their node_modules. So either all React component authors get on the Babel train, or they start shipping ES6 `main` entries. Either way is a little bit painful.

It's progress, no doubt, but there will be some stumbles along the way.

Re:React v15.5.0 by TheAceOfHearts on Friday April 07, 2017 @08:33PM (#14064526)
I think what we need is a mix between a module bundler and package manager. When you pull in a dependency, it should confirm the code can run on all your targets. If it wouldn't run, e.g. ES2015 classes but you have an ES5 target, it should be compiled. That way when you bundle your app, you can skip the compilation check on all third-party modules. Adopting an incremental compilation strategy will also speed up larger apps.
Re:React v15.5.0 by spankalee on Friday April 07, 2017 @08:36PM (#14064539)
It's really time to start distributing ES6 via npm. All current browsers support ES6. It's now generally faster than equivalent ES5, it minifies better, tooling is better, etc.

It's the app that should compile all the code to run in the target environment if needed. This is what we've done in the new Polymer CLI / polymer-build: we compile all dependencies but only if necessary.

Re:React v15.5.0 by Silhouette on Friday April 07, 2017 @09:43PM (#14064785)
All current browsers support ES6.

That's debatable, particularly when you factor in bugs. However, even if they did, it seems unwise to assume that all relevant users for all or even most projects will be on the latest evergreen browsers. Several large groups, including business users on IE and mobile users on slightly older devices, probably won't be.

I know there's a certain type of web developer who would love for everyone to have updated their browser within the last five minutes so all the new toys are available universally, but that has never been the nature of web development. Deliberately breaking major infrastructure is just going to make JS development even more screwed up than it already is.

Re:React v15.5.0 by debaserab2 on Friday April 07, 2017 @10:49PM (#14065006)
This is a common theme I'm noticing a lot lately. Meanwhile, I check my product's browser breakdown and IE9/10 is still too significant to ignore. There's just no way our customers would be okay with this. Many are still locked on older IE versions due to (bad) corporate policies. I can't strongarm them into upgrading.

Which leads me to wonder: are developers that are so willing to advocate breaking compatibility with older browsers actually deploying real sites that have normal representative user audiences? Or is this an insular group of developers mostly making things for each other?

Re:React v15.5.0 by marcusarmstrong on Saturday April 08, 2017 @12:11AM (#14065266)
For whatever my anec-data is worth, I run a sports stats website as a hobby (which has a decidedly non-developer user base), and when looking at my own user breakdown I found that less than .1% of my traffic was IE10 or below.

So while there's still likely an insular group at play, it's not limited to just developers.

Re:React v15.5.0 by Silhouette on Saturday April 08, 2017 @12:18AM (#14065288)
Stats for older IE versions are similar for most sites/apps I'm involved with, though I know in some niches they are still important.

IE11 is a different case entirely, though. Almost everything still gets significant traffic on that platform, and in the business world supporting it is pretty much essential. Not much ES6 support there, though.

Re:React v15.5.0 by debaserab2 on Saturday April 08, 2017 @12:55AM (#14065377)
Yeah that's interesting. I might be biased since I'm in an exclusive B2B market.

Still though, it's hard to adopt a policy that axes even just 1% of your customer base just for the sake of easier development cycles when alternate options exist.

Re:React v15.5.0 by Silhouette on Saturday April 08, 2017 @09:40AM (#14066835)
Oh, I completely agree. If in your circumstances older IE builds are still significant then of course you might want to continue supporting them. I'm just suggesting that that issue is somewhat separate to the original point, because in the case of ES6 support, even the latest version of IE doesn't have it.
Re:React v15.5.0 by Silhouette on Saturday April 08, 2017 @12:05AM (#14065250)
I'm afraid this culture is now endemic in web development. Everyone expects everything to be free, so the people building most of the tools, from the libraries to the browsers themselves, are mostly either doing it for fun as an amateur or doing it professionally in order to support something that does bring in revenues. Neither of these necessarily implies writing or maintaining ideal tools to support web development more widely; any wider benefit is largely coincidental. Unfortunately, because so much of the influence is now concentrated with so few organisations or even individual people, and most of them are aligned on this, it's going to be difficult to return to a more widely supportive ecosystem now.
Re:React v15.5.0 by matt4077 on Saturday April 08, 2017 @02:04AM (#14065561)
Let's dispense with the "amateurs" first: the complete stack is build almost exclusively by people employed by Google, Facebook, Apple, Mozilla, and a handful of smaller, but at least as professional, companies.

Then, I don't understand the rest of the argument. Open Source software has simply won in the marketplace, mostly because of it's openness, rarely because of it's price.

Example: Operating Systems, which is the rare beast where an actual closed-source competitor still exists. Yet the Windows marketshare on the server is around 10%, and I doubt that it's the price that encourages all those Unicorns to chose Linux. Databases are a similar story.

> Neither of these necessarily implies writing or maintaining ideal tools to support web development more widely

It doesn't necessarily do that, but in the case of Google specifically, it does: they need the open web as a platform to compete against the "walled gardens" of Apple and Facebook. Their interests happen to be aligned with those of web developers, which is why Chrome has revitalised browser competition, easily beating the laser-focused team at Mozilla.

> Unfortunately, because so much of the influence is now concentrated with so few organisations or even individual people

The influence is spread out far wider today than it was at the time where Microsoft and Flash were able write APIs without asking anybody.

But, more importantly, I'm unsure what you want? A version of React that supports IE 6 and lynx? They have that, it's called XHTML 1.0 Transitional.

Re:React v15.5.0 by Silhouette on Saturday April 08, 2017 @10:12AM (#14066985)
Let's dispense with the "amateurs" first: the complete stack is build almost exclusively by people employed by Google, Facebook, Apple, Mozilla, and a handful of smaller, but at least as professional, companies.

You might like to take a look at the history of Babel (formerly 6to5) as one prominent counter-example. For several years, much of the web development community has been relying on a great tool that was originally written by one talented young amateur.

Open Source software has simply won in the marketplace, mostly because of it's openness, rarely because of it's price.

Chrome being prominently advertised every time anyone visited a Google site using another browser probably didn't hurt. Being installed by default on the most popular mobile OS also didn't hurt. If openness were all it took, Firefox would surely still be a more prominent player.

It doesn't necessarily do that, but in the case of Google specifically, it does: they need the open web as a platform to compete against the "walled gardens" of Apple and Facebook.

Google wants people to use the Web because it makes its money primarily from advertising on web sites. It is in Google's direct financial interest to support the part of the Web ecosystem that in turn supports advertising. That typically doesn't include, for example, corporate intranets, or embedded UIs in network-connected devices, or academic sites, which are three big areas where web technologies are widely used but stability and long-lasting content are more highly valued.

Their interests happen to be aligned with those of web developers, which is why Chrome has revitalised browser competition

Writing as a professional web developer who often works in those other areas I mentioned, Chrome hasn't revitalised browser competition. On the contrary, it's become the new IE from the old browser wars. A lot of the new functionality only works properly in Chrome, and often it's not reliable even there because of the frequent updates that change behaviour and/or introduce regressions. There's no real concern about proper standardisation or compatibility or longevity any more.

But, more importantly, I'm unsure what you want?

I want the fundamental tools on which much of the ecosystem now relies not to break everything that predates a standard that is less than two years old and still not fully supported across many active browsers. In this case, that means being able to install packages from NPM with a reasonable expectation that they will not require a substantial extra build process to be used.

Obviously no-one contributing NPM packages has any obligation to respect that. It's not as if we're all paying for their openly licensed work. I just think the community as a whole will otherwise suffer yet more overheads getting infrastructure set up instead of actually getting useful work done.

Re:React v15.5.0 by marcus_holmes on Saturday April 08, 2017 @01:43AM (#14065517)
Agree. This is Maker's Triangle stuff (Good, Cheap or Fast, pick two). Everyone is picking Cheap and Fast, and not only Cheap, but Free, so the amount of Good left in this stuff is non-existent.

If there's no Good chosen, then it all gets crufty and full of tech debt. So someone else thinks they can do better, and starts developing a replacement. In order to get traction, though, they need to make it Free and develop it Fast, so after a while they start taking a few short-cuts, and round we go again.

I have faith that it'll settle down eventually, but until then...

Re:React v15.5.0 by matt4077 on Saturday April 08, 2017 @02:18AM (#14065605)
I'm unsure if this Maker's Triangle thing applies to OSS. But if it does, it's my impression that it's usually the "Fast" that is abandoned, not the "Good".

But how does that apply to Chrome, or React? Is there any indication that Chrome carries more technical debt than, say IE7? Similarly, in what way does Facebook need people to adopt React, and would that matter enough to accept such compromises? Is there any indication that their code quality is inferior to <pick whatever commercial js library you want>?

And if this is the complaint about churn, that, at this time would be older than our js stack if it were true: React came out in 2013, it's four years old. Before that, most people probably used JQuery, which came out in 2006, i. e. 11 years ago. Is learning a new library every five years too much, considering this is one of the most dynamically evolving ecosystems of technology?

Re:React v15.5.0 by Silhouette on Saturday April 08, 2017 @10:35AM (#14067094)
To continue the analogy, the JavaScript community doesn't believe in technical debt. It just declares itself bankrupt every few weeks and moves on, leaving anyone who was relying on earlier arrangements to cover the costs.

To extend it further, this is why you should be very careful who you give credit to in the JavaScript ecosystem. If you're trying to build anything robust and potentially long-lived, relying on anything but the largest and most established dependencies is usually unwise, and even then relying on any any aspect that isn't in mainstream use is a risk.

Re:React v15.5.0 by tracker1 on Sunday April 09, 2017 @06:36PM (#14074704)
As someone who's been building against browser/web tech for over two decades now... that React is emphatically no less than "Good"... The diagnostic messages alone are leaps and bounds ahead of anything else I've used. Angular just breaks in weird ways with no warnings, sometimes non-sense error messages, other platforms likewise... React regularly warns on usage that might break something in the next release, and more than a clue how to fix it. Nothing else I've used comes close to that. Not that it was your implication.

Now, I'll admit, I've dev'd against React and deployed with preact-compat as a build sub for size... but a couple times back to React for broader support, and it really didn't save on speed anyway.

React is hands down the first web tech I've used (out of dozens of platforms and toolkits over the years) that just made sense. Not everything I agree with, and would love some adjustments. All the same, more often than not, it does what I expect, and I definitely can't say that of most of the rest.

As to jQuery, I think it's a great idea, was and still is in a lot of ways. I do wish they'd just drop their XHR, and Promise implementation at this point... but the selection library + eventing is cool and easier to grasp to this day, despite going without it for about 2 years now. There are cases where it was just nice, and still is.

I'm actually fine with JSX, imho it's better having some XML in my JS than it ever was having weird DSL in templates in JS.

Re:React v15.5.0 by sjellis on Saturday April 08, 2017 @03:44AM (#14065833)
I think that there is a real split between consumer and corporate at this point (certainly in the West). Some managed corporate setups are definitely still on old versions of IE, but for everyone else, the path of least resistance has been auto-updated platforms for a while now (Windows 10 + Edge, iOS, Chrome, Firefox).

Recently, I updated the browser support docs for my employer, and was surprised to note that IE11 is now the oldest browser with standard vendor support, so everybody on older versions of IE is either working for a company with specific extended support contracts with Microsoft, or they are running with no support at all.

Re:React v15.5.0 by tracker1 on Sunday April 09, 2017 @06:22PM (#14074651)
I propose a warning... "For security reasons, all versions of Internet Explorer are no longer supported. Please upgrade to a modern/current browser such as Chrome, Firefox or Edge."

Make sure to state "For security reasons" policies always have that even when it's not true, or bad security, because most people don't question it.

Re:React v15.5.0 by debaserab2 on Sunday April 09, 2017 @11:15PM (#14075737)
That would scare the hell out of my users and immediately increase support volume by a not insignificant amount. There's not a lot of sense in doing that anyways since many/most of the users stuck on old browser versions are stuck due to corporate policy.
Re:React v15.5.0 by tracker1 on Monday April 10, 2017 @01:16PM (#14080529)
Then their corporations are running old/insecure browsers... the end. It's not my job to coddle corporations that are endangering their own users.
Re:React v15.5.0 by debaserab2 on Monday April 10, 2017 @09:40PM (#14084201)
Yes, actually, if that's who you are selling your product to it is exactly your job to be doing that.
Re:React v15.5.0 by spankalee on Saturday April 08, 2017 @12:02PM (#14067542)
If your users need ES5, then compile to ES5. The packages you use can't know that though. I'm not advocating for breaking anything.
Re:React v15.5.0 by matt4077 on Saturday April 08, 2017 @01:44AM (#14065519)
The situation has really improved, mostly due to auto-updating, increased competition between browsers, the iPhone's power to compel modernisation, and the resulting fading of proprietary technology like flash or ActiveX.

Sure, google.com probably needs to support IE 6. For my own business, I'm not willing to make compromises for browsers below 2%. That currently means Safari 10, Chrome 56, and IE 11. And IE 11 is really stretching it by now–next time it gets in my way, I'll give people a reason to upgrade.

Now I don't have "enterprise" customers, and it's a rather small business. For anything medium-size up, the calculus changes, and probably makes it worthwhile. But at some point, these mystical "enterprises" really have to get their act together and stop dragging technology back to 2006.

Re:React v15.5.0 by debaserab2 on Saturday April 08, 2017 @12:08PM (#14067573)
That's crazy to me: you'd give up 2% of your customer size (and potential revenue?) just to make your dev workflow more convenient?
Re:React v15.5.0 by growtofill on Saturday April 08, 2017 @12:39PM (#14067748)
This can be justified. Multiple times I'd been in the spot when shipping of a feature by a certain date will get your contract signed. And this is dependant of how convenient your workflow is.
Re:React v15.5.0 by CognitiveLens on Sunday April 09, 2017 @05:12PM (#14074397)
particularly for a young or fast-growing product, this makes a ton of sense - shipping features that multiply your target market can be a _much_ better strategy than keeping 2% of your current user base.
Re:React v15.5.0 by spankalee on Saturday April 08, 2017 @12:01PM (#14067537)
Chrome, Firefox, Edge, Safari and Opera all support ES6. That's the current version of all major browsers.

But, I'm not arguing that web sites should only serve ES6 to browsers, only that packages should be distributed as ES6 and the app should be responsible for compilation.

Re:React v15.5.0 by Silhouette on Saturday April 08, 2017 @04:26PM (#14068823)
Chrome, Firefox, Edge, Safari and Opera all support ES6. That's the current version of all major browsers.

No, it isn't. For a lot of web developers, two of those aren't major browsers at all and you've missed the 800lb gorilla. You're also ignoring older versions of mobile browsers, the current Firefox ESR, and at least one other browser that has a larger market share than several of the above in parts of Asia, among other things.

But, I'm not arguing that web sites should only serve ES6 to browsers, only that packages should be distributed as ES6 and the app should be responsible for compilation.

And consequently, the entire community has to start incorporating a heavyweight build process that relies on third party tools just to use modules from the de facto standard package repository, and everyone also has to take extra time checking the exact requirements for every module they directly or indirectly depend on to make sure their build process supports it. In an ecosystem with absurd levels of microdependencies, which is certainly what we have today in JS world, the last thing we need is moving goalposts on the basic assumptions that everyone makes. This sort of thing is exactly why proper, long-lived standards are important as the foundation of a productive development ecosystem.

Re:React v15.5.0 by spankalee on Saturday April 08, 2017 @06:48PM (#14069487)
Yes, "current version" specifically doesn't include "older versions", that should be uncontroversial.

Not sure the 800lb gorilla you're referring to, but maybe UC Browser? That thing is so odd it's difficult to know what it supports, and it's not supported in nearly any popular CI service. I'm sure all kinds of things are broken on it, but you can still compile your app to ES5.

And ES6 _is_ a proper long lived standard. I'm not sure what would be more standard.

Compiling dependencies is not that heavyweight, especially when there is no configuration. Babel and TypeScript are fast. The results can be cached, it can be done on the fly for dev servers. Requirements shouldn't need to be checked - I'm not advocating for distributing code using decorators or class properties, nor modules (which without the HTML spec on module specifiers isn't a fully functional spec anyway) just plain ES6.

ES5 and ES6 classes cannot coexist on the same proto chain. Compiling to ES5 prevents things like mixins being usable against ES6 superclasses, so you force all dependents to be ES6. If you're going to force one way or the other, force in the future direction where there's still the option to compile the whole app to the older version of JS. ES5 classes can't extend subclassable built-ins like Array, Promise, Set, Map, HTMLElement, Error, etc. ES5 is now mostly slower than the equivalent ES6, it also doesn't minify as well as ES6.

Re:React v15.5.0 by rk06 on Sunday April 09, 2017 @03:16AM (#14070908)
>Not sure the 800lb gorilla you're referring to

Are you kidding? she/he is talking about IE.

Re:React v15.5.0 by frik on Saturday April 08, 2017 @12:52AM (#14065370)
Many user are still on ES5/JS5 capable browser.

IE11, older FF and Chrome, and especially older mobile devices with older Webkit based browser (Android and iOS)

Re:React v15.5.0 by tracker1 on Sunday April 09, 2017 @06:41PM (#14074724)
There's still a handful of features (though far fewer than 2 years ago) that I need babel for anyway, so just sticking with that, and may adjust my babel-preset-env config as things change. I may even do dual builds, one for bleeding edge (a bit more than half the users) and a catch-all ES5 build. YMMV.
Re:React v15.5.0 by STRML on Friday April 07, 2017 @08:41PM (#14064562)
I agree that this is the future. But that will mean telling everyone that they should now run their node_modules through Babel - no inconsequential feat, given the size of the code that must now be transpiled.
Re:React v15.5.0 by untog on Friday April 07, 2017 @10:56PM (#14065031)
It's not just that - is JSX part of ES6? It isn't, but a lot of pre-Babel transpiled code uses it. So people would need to transpile to ES6 for distribution, then to ES5 when someone uses the library.

Messy.

Re:React v15.5.0 by spankalee on Saturday April 08, 2017 @11:57AM (#14067516)
Don't distribute JSX, it's not JavaScript. Distribute what engines actually support.
Re:React v15.5.0 by untog on Sunday April 09, 2017 @04:15PM (#14074133)
A nice sentiment, but you could say the exact same thing about ES6. "What engines actually support" is a pretty fuzzy metric.
Re:React v15.5.0 by wesleytodd on Saturday April 08, 2017 @01:11AM (#14065427)
I agree, I am really concerned about this change. But unfortunatly I do not think my feedback via twitter was well taken: https://twitter.com/wesleytodd/status/850550711804989440

EDIT: I should add, that I didn't want to say that I completely disagree with the change to remvoe this api entirely on twitter to the maintainers. I am sure they get enough crap from people.

Re:React v15.5.0 by spicyj on Saturday April 08, 2017 @03:47AM (#14065840)
Thanks for the feedback, we do appreciate it.
Re:React v15.5.0 by wesleytodd on Saturday April 08, 2017 @10:30AM (#14067075)
Well thanks then! I know social media sucks for this kind of stuff. And I am sorry for my contribution to that. And know we really all do appreciate it, we are just passionate and opinionated people.

Personally I am more concerned about keeping my team building cool features than updating react. This has led to us having two distinctly non-interoperable code bases, one with react 0.12 and one with react 14-15. This makes me worried that now we will have a third with react >15.

I think we can all agree that many of the ideas, while not new, were revolutionary to front-end web developers. And that is what I love about working in this stack. But other than these ideas, the projects themselves are just stumbling along trying to catch up with some perceived "modern" way of coding, and it is the dev teams and projects that suffer.

Re:React v15.5.0 by acemarke on Saturday April 08, 2017 @01:56PM (#14068087)
Out of curiosity, what issues are holding you to React 0.12 on that first codebase?
Re:React v15.5.0 by spion on Friday April 07, 2017 @08:23PM (#14064494)
Isn't there option (3) as well? Which would be, writing classes the old way, using prototypes and something like `util.inherits`
Re:React v15.5.0 by acemarke on Friday April 07, 2017 @08:30PM (#14064519)
That's basically what `createClass` does: https://github.com/facebook/react/blob/72196da82915bee400edb...
Re:React v15.5.0 by fiatjaf on Friday April 07, 2017 @08:27PM (#14064512)
Are you afraid of Babel monopoly? I recommend trying https://buble.surge.sh/. My life is much better after I started using Buble and bubleify instead of this mess that is Babel.
Re:React v15.5.0 by STRML on Friday April 07, 2017 @08:42PM (#14064566)
Come on. Buble is Babel, just with a few presets hardcoded. Yeah, it's better usability, until you need to run a production application.
Re:React v15.5.0 by evilduck on Saturday April 08, 2017 @08:42AM (#14066629)
Re:React v15.5.0 by STRML on Saturday April 08, 2017 @09:34AM (#14066814)
Yeah, I'm actually completely wrong. My apologies to the Buble team. For whatever reason, I thought I saw an announcement of Buble essentially saying it was an opinionated feature-freeze of Babel with most of the configuration stripped out, but it appears to be a totally new project.

That said, the two are very different tools. Buble appears to be essentially string manipulation (which Babel does to occasionally with babel-template) built on top of Acorn. It's much simpler but there are a lot of useful transformations you simply can't do with that approach.

Edit: After some further looking into the project, I have to say that it seems like it would nice & easy to use for simple transformations, like the aforementioned React.createClass -> class Foo extends React.Component. However, you have to keep in mind that code that is not spec-compliant will break in mysterious ways perhaps months or years into the future. It may not be worth it, despite the ease.

`yarn install babel-cli babel-preset-es2015; ./node_modules/.bin/babel --presets es2015 <sources> -d <out-dir>` is not particularly difficult.

Re:React v15.5.0 by fiatjaf on Saturday April 08, 2017 @12:23PM (#14067656)
> will break in mysterious ways perhaps months or years into the future

Since you already recognized you know nothing about Buble can you please stop making absurd claims about THINGS YOU DON'T KNOW?

What are specs, by the way? I don't care if Buble isn't following stupid specs. Browser vendors will change these specs a million times, Babel will follow up with new versions with a thousand breaking changes and require you to install a ton of packages, clean old packages, erase your hard disk and kill your neighbours. Buble will just keep working.

Re:React v15.5.0 by fiatjaf on Saturday April 08, 2017 @01:23AM (#14065458)
Oh is it? They deceived me!
Re:React v15.5.0 by fiatjaf on Saturday April 08, 2017 @01:24AM (#14065464)
Hey, it isn't.
Re:React v15.5.0 by skrebbel on Saturday April 08, 2017 @03:57AM (#14065873)
Why do you lie?
Re:React v15.5.0 by uieefx on Friday April 07, 2017 @09:01PM (#14064637)
you know...if it can be transpiled by babel that means you could write it in es5 compatible syntax...yourself...so if you don't want to use the babel tool chain...what's stopping you? Don't know es5? IMO it's not too fun compared to es6...but...
Re:React v15.5.0 by uieefx on Friday April 07, 2017 @09:17PM (#14064688)
Sorry hn downvote police, but it is a true statement, even if you don't approve of the tone.