News for hackers. Stuff that matters.
Re:What I wish I knew about React by ggregoire on Wednesday April 29, 2020 @03:55AM (#23016584)
> I am not so up to date with frontend dev but what's with the hate towards React these days?

HN is rarely the place to read constructive comments about JavaScript and frontend development.

Personally I've been developing web apps for 10 years (with technologies such as Spring, ASP.NET, CakePHP, Symfony, Django, jQuery, Backbone.js, Angular 1) and I quite enjoy React. I think it makes my job easier and I feel productive with it.

Also, TypeScript is awesome.

Re:What I wish I knew about React by chadcmulligan on Wednesday April 29, 2020 @05:11AM (#23017053)
Its reaching the point where it is becoming standardised, and therefore not interesting, and so it must pass, and a new framework will become the one to use for web development. It's axiomatic that web development must be cool and new and therefore no framework can ever become a standard.
Re:What I wish I knew about React by sjwright on Wednesday April 29, 2020 @11:13AM (#23020194)
I still write web in ColdFusion and (mostly) plain JavaScript. Seriously. I’m not cool at all.
Re:What I wish I knew about React by jaeyson on Thursday April 30, 2020 @06:17AM (#23029305)
I'd still say cool tho.
Re:What I wish I knew about React by karolsputo on Thursday April 30, 2020 @05:56AM (#23029186)
I see a lot of pro-Svelte comments/entries on HN. It seems to be endorsed stronger than the mainstream, big libraries right now
Re:What I wish I knew about React by mercer on Thursday April 30, 2020 @09:09AM (#23030385)
My impression is that for a lot of developers on HN, a kind of front-end fatigue has grown stronger and stronger. And as a result, there's a preference for various solutions that reduce the amount of 'dynamic javascript' work required.

While I'm not particularly hostile to javascript or React myself, I do notice that over time, I tend to avoid it whenever I can. It wasn't too long ago that I made (gentle) fun of Intercooler.js (what happened to that person and their tireless efforts to insert it into any vaguely relevant conversation?), for example.

But nowadays, I'm fully on the Phoenix LiveView bandwagon (React/js on the server!), and I would absolutely use Svelte or Intercooler if LiveView wasn't an option, I grumble whenever I need to deal with my js pipeline (Webpack, PostCSS, etc.), and whenever I do need to deal with it, I get an almost existential 'where did things go wrong' feeling. Maybe I'm just getting old, in front-end developer terms anyways.

All I know is that for the past year I've barely kept up to date on the latest in React (Hooks?!), CSS (grids? flexbox?), js bundlers, browser features (webworkers? the latest in LocalStorage? webcomponents?), and so on, and instead I've been dealing with databases, servers (nginx, linux, etc.), and other 'back-end' things instead.

I feel much, much less frustration because suddenly things stop working and I need to dive into the complex world of webpack and its loaders, CSS and it's various browser incompatibilities, and so on. But I also feel that the things I /do/ learn will probably be valuable for years to come.

The insane amount of stuff I've learned about jQuery is practically worthless now. The same goes for Bootstrap and Backbone.js. Or various CSS layout tricks (dear god the floats). But what I'm learning about Postgres and Ngix and Railsy back-ends seems like the kind of stuff I'll be able to use (and make a living off) for a long time to come.

I do really like TypeScript though. I'd love to use that more :).

Re:What I wish I knew about React by dandigangi on Wednesday April 29, 2020 @11:16AM (#23020237)
> HN is rarely the place to read constructive comments about JavaScript and frontend development.

So, so true. Not even just JS though. Community can be rough on people generally.

Re:What I wish I knew about React by kreetx on Wednesday April 29, 2020 @04:01AM (#23016632)
What's a good place for front-end dev discussions, especially the type which are more on the meta-level?
Re:What I wish I knew about React by m5r on Wednesday April 29, 2020 @09:28AM (#23018844)
Twitter can be a good place sometimes

/r/webdev, /r/javascript and /r/reactjs too

Re:What I wish I knew about React by fit2rule on Wednesday April 29, 2020 @05:10AM (#23017051)
http://lobste.rs is a good starting point. Not as much hate there..
Re:What I wish I knew about React by wtmt on Wednesday April 29, 2020 @01:51PM (#23022061)
Related question: Does it still require hanging around and waiting for an invite to create an account? If yes, then I’m not going to try again and waste my time.
Re:What I wish I knew about React by fit2rule on Thursday April 30, 2020 @04:08AM (#23028603)
Its not hard to get an invite. I'd invite you if I knew your address.

I consider this a slight inconvenience but still a better system than having the dang hammer around to pound spammers ..

Re:What I wish I knew about React by tenaciousDaniel on Wednesday April 29, 2020 @09:35AM (#23018904)
I've been considering the jump into TS, but I don't want to end up in a coffeescript situation (i.e. language is dead, but code lingers on and has to be converted back to JS at some point, rather painfully). Do you think it's worth it?
Re:What I wish I knew about React by slewis on Wednesday April 29, 2020 @10:21AM (#23019563)
Yes. It’s built by Microsoft and has huge adoption. Typescript is here to stay.
Re:What I wish I knew about React by akie on Wednesday April 29, 2020 @12:11PM (#23020862)
What if most of TypeScript is embedded into the next version of JavaScript, as happened with Coffeescript?
Re:What I wish I knew about React by zdragnar on Wednesday April 29, 2020 @12:41PM (#23021174)
Typescript offers almost no runtime behavior. With a few exceptions, everything is stripped out, and it only offers to transpile modern JS features to older browsers. CoffeeScript was all about an alternate syntax for runtime behavior.

JS isn't going to get compile time anything. There was an attempt at adding "strong mode" by one of the google / chrome teams iirc and that went nowhere.

Re:What I wish I knew about React by Zarel on Wednesday April 29, 2020 @01:33PM (#23021852)
All I really wanted was to allow type annotations in JavaScript. So you wouldn't need a compile step while running (JavaScript would just ignore the type signatures), but TypeScript could check it whenever. I believe this is the approach Python uses.

I think there were discussions of doing that at some point, but it seems to have gone nowhere.

Re:What I wish I knew about React by StrangeSound on Wednesday April 29, 2020 @12:28PM (#23021036)
Then there's not really a problem. You learned how it works, and now it's one less thing to worry about
Re:What I wish I knew about React by hombre_fatal on Wednesday April 29, 2020 @12:42PM (#23021199)
Also, if Javascript got its own type system somehow (not gonna happen anytime soon), you could expect Typescript to compile to it.

And you could transition off of Typescript just as gradually as you could transition on to it.

Re:What I wish I knew about React by JackMorgan on Wednesday April 29, 2020 @10:35AM (#23019732)
I just switched a pretty huge project into TS, and I'm seeing for this team and project, probably 4 units of saved time in the PRO column, and 3 units of lost time in the CON column. Still worth it, but you'll need to learn and maintain a new thing, and sometimes doing a totally normal JavaScript thing would force you to write some pretty eldrich type signatures.
Re:What I wish I knew about React by fpoling on Wednesday April 29, 2020 @12:04PM (#23020785)
You may also consider Flow. It is literally JavaScript plus type annotations. The annotations can be even put into comments turning the files into vanilla JS making this very clear. So there is no danger that if FB abandons it one ends up with code that needs to be converted.

On the other hand Flow is much less cool than TypeScript these days. Plus using it for development under Windows have issues, although FB has started paying attention to them.

Re:What I wish I knew about React by Zarel on Wednesday April 29, 2020 @01:30PM (#23021822)
TypeScript annotations can also be put into comments. I like TypeScript's approach (JSDoc) better, actually, because it's how you'd want to annotate them even if you didn't have a typechecker, anyway.

Although I still hit enough annoyances that I'd go straight to `.ts` files for my next project.

Re:What I wish I knew about React by FeloniousHam on Thursday April 30, 2020 @11:15AM (#23031731)
We started out with Flow, but moved to Typescript not because it's "cool" (I suspect it's the Flow users who are smoking clove cigarettes in black berets), but because the language improvements and tooling support are a huge productivity boost. The killer is how flexible it is, it incrementally scales from straight JS to full-on type religion. You only have to use as much as you find useful.
Re:What I wish I knew about React by TechBro8615 on Wednesday April 29, 2020 @03:35PM (#23023215)
If you decide to make the jump, I found tsdx to be really useful boilerplate generator for getting started: https://github.com/jaredpalmer/tsdx
Re:What I wish I knew about React by mercer on Thursday April 30, 2020 @09:15AM (#23030436)
I've been doing less and less JS stuff, but I actually miss TS at times. I think it won't end up like CoffeeScript, and it's absolutely worth using if you need to write javascript!
Re:What I wish I knew about React by carry_bit on Wednesday April 29, 2020 @10:54AM (#23020002)
Unlike coffeescript which had a fundamentally different syntax, typescript is just modern javascript plus types.
Re:What I wish I knew about React by davnicwil on Wednesday April 29, 2020 @11:49AM (#23020613)
I agree and won't repeat this point in a sibling comment, but just a slight nuance is that there are in fact some extra features/syntax TS has that JS doesn't, such as enums.

You have to be aware these features would need to be manually converted back to JS were you ever to switch back. Honestly this would likely not be a significant amount of work, especially if you don't overuse them, but just to make you (GP) aware.