Live data from Hacker News

What I wish I knew about React

bitsofco.de

211–220 of 301 posts

Re: What I wish I knew about React

#211
post #166

Earlier quoted context omitted.

I love React and write it, in Typescript, on a daily basis. However: - It starts you off with about 40kB of minified gzipped javascript; some developers feel that it's too much. - It is not and probably never will be the most performant framework out there, which upsets quite a few people (although the work that the React core team is doing with Concurrent Mode probably means that from the end user's perspective Reac…

Your last point is a cause of some apprehension for me. In the team I'm currently working with one of my coworkers calls himself a React Developer, and my experience has been that anytime an issue arises that may not be specific to React, this person's ability to problem solve significantly diminishes. I've seen it in a couple of other individuals as well, and I feel it's becoming more widespread, though I hope I'm w…

Maybe bring it up to him with constructive criticism? Tell him the wind tends to change direction and one shouldn't typecast themselves in this field.

Re: What I wish I knew about React

#212
I tried React and hated it, especially JSX, but I made some decent money working on React projects in the past. I much prefer libraries/frameworks where the view is completely separate and is more “pure” HTML. I ended up creating my own framework that was much easier to understand and manage, but is obviously not generic enough to publish. Maybe one day I’ll clean it up and push it to a Github repo, but then again, does the world need yet another MVC framework? I think not.

Re: What I wish I knew about React

#213

Earlier quoted context omitted.

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?

Unlike coffeescript which had a fundamentally different syntax, typescript is just modern javascript plus types.

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.

Re: What I wish I knew about React

#214

Earlier quoted context omitted.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... > JavaScript classes, introduced in ECMAScript 2015, are primarily syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript. You've been tricked into thinking you're using a class, but you're really not. I understand it's a useful trick, but hooks a…

I disagree. I think that's like saying C++ doesn't actually have classes, it's just syntactic sugar around structs of function pointers. It may be technically correct , but C++ and now JS have a "class" keyword for a reason, and that's to steer you towards organising your code into classes which operate in certain ways. In both languages you can avoid using classes, sure, or abuse classes in various ways. But fundame…

But what good are classes if you're not doing object-oriented programming? React classes are just stateful wrappers around a pure render function. It's not idiomatic and frankly dangerous to do anything you would with a regular ES6 class with a React.Component.

Re: What I wish I knew about React

#215
post #98
post #71

Earlier quoted context omitted.

Yeah but how is that different from any other UI framework? onCreate/onStart/onResume and onComponentDidMount, onPause/onStop/onDestroy and onComponentWillUnmount are basically the same. Be it Android, Swing, or Qt, everywhere it's the same pattern. React is the first framework which actually feels like UI development on the web, not anymore like JS spaghetti. In fact, having internal state, externally given props, e…

I think lifecycle methods in general, no matter what the framework is, are a suboptimal way of doing things. React works quite differently and shoehorning it into a lifecycle thing was holding it back, or at least that's how I feel. YMMV. At least it looks like we agree that React is a decent framework :-) That said, for us devs who do both native and JS code, the condescending part is quite hilarious as well ;-)

I'm doing JS (vanilla and with React), Android and native (well Qt) myself.

It's just funny when pure JS devs go all "no you won't convince me to compile my code / use classes with lifecycles / etc, that's against the natural order!!!"

Re: What I wish I knew about React

#216

Earlier quoted context omitted.

Really? I would have put C++ and Java near the top of the “most ridiculed languages” list.

As the old mantra goes, "there are two types of languages, the ones that everyone complains about, and the ones that nobody uses".

That's true because the more first-mover-y languages that came to dominate are shit compared to subsequent, more innovative ones.

When the latter become dominant, there should be even more subsequent, innovative ones.

And the cycle will repeat.

But it's less net shittiness with every generation. And how many generations are we even in so far? C is '70s security gore, C++ is an '80s attempt to force OO memes that we've come to regret onto the '70s security gore, Python and Java are '90s OO memes in earnest, JavaScript and PHP were kludgy mistakes slapped together in a fit of desperate confusion to get some web shit to run, aaand...

Re: What I wish I knew about React

#217

Earlier quoted context omitted.

> 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 product…

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?

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

#218

Earlier quoted context omitted.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... > JavaScript classes, introduced in ECMAScript 2015, are primarily syntactical sugar over JavaScript's existing prototype-based inheritance. The class syntax does not introduce a new object-oriented inheritance model to JavaScript. You've been tricked into thinking you're using a class, but you're really not. I understand it's a useful trick, but hooks a…

I disagree. I think that's like saying C++ doesn't actually have classes, it's just syntactic sugar around structs of function pointers. It may be technically correct , but C++ and now JS have a "class" keyword for a reason, and that's to steer you towards organising your code into classes which operate in certain ways. In both languages you can avoid using classes, sure, or abuse classes in various ways. But fundame…

> steer you towards organizing your code into classes which operate in certain ways

But that’s the point. The way in which classes operate in JS is different from the way classes operate in OOP focused languages like C++, Java and C#. That’s because the language doesn’t have classes, but rather syntax to make it look like it does. On the surface your code will be organized in similar ways but the underlying behavior is different.

Re: What I wish I knew about React

#219
post #191

Earlier quoted context omitted.

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?

Yes. It’s built by Microsoft and has huge adoption. Typescript is here to stay.

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

#220
post #193
post #131

Earlier quoted context omitted.

HN is a pretty hateful place in general.

If you're coming from Reddit, Imgur or YouTube it seems like hate, but I've found it's simply a lack of humor... Any jokes, memes or puns are frowned upon the community 99% of the time. I suppose it's considered redundant or not-constructive...

That's only because 99% of jokes aren't as good as people thought they were when they pushed the submit button.

HN has a great sense of humor. I know this of course because my jokes have been upvoted.

Post reply on HN