Live data from Hacker News

What I wish I knew about React

bitsofco.de

221–230 of 301 posts

Re: What I wish I knew about React

#221

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, d…

> I ended up creating my own framework that was much easier to understand and manage, but is obviously not generic enough to publish.

You lost me there.

Cute for a solo/learning project, but when other people are touching the project or you're trying to build a business, you have to answer for why your project was so special that it needed its own ad hoc framework. As opposed to, say, a framework with real documentation. Or one with an ecosystem so you can escape this culture of NIH.

When I hear someone building their own JS framework, I see someone who wanted to procrastinate the hard part (building a business, shipping a product, appealing to users). Like when game developers decide to build an engine and never make the game, aka the hard part (https://www.voxelquest.com/).

Re: What I wish I knew about React

#222

Earlier quoted context omitted.

I don’t think it’s necessarily success, but novelty. C++ and Java are immensely popular and get nowhere near the vitriol that the thing you mentioned do. Often there’s a number of people on the opposite side cheerleading the thing as well, which underlines the apparent conflict. (Rust is already being complained about, by the way.)

As a C++ developer who occasionally helps a friend hack on a Rust hobby project, I've been waiting for the other shoe to drop on Rust. Not necessarily because I have many complaints about it, but because I consider it in essence very similar to C++17, with (not-too-)different syntax and a few different but important design decisions in the core language and standard library. Seeing it sold as a radical paradigm shift…

C++ has no notion of a borrow checker and I am not aware of static checkers for the language that provides a coverage close to that of the Rust compiler.

As I continue to see how very experienced C++ programmers make exploitable bugs that passes all reviews and that are compilation errors in Rust saying that Rust is C++ with a different syntax is very naive.

Re: What I wish I knew about React

#223

Earlier quoted context omitted.

> "Everything an HTML tag" is an insane mantra to have. I don't think this is a React mantra at all. Maybe "everything is a function" would be a modern React mantra? Seeing how React code is mostly hooks and components, and both are nowadays generally written as functions. JSX is not even required when writing React, by the way. It's just syntactic sugar. > It's crazy to me that it's normal now to have like 3-4 compi…

>JSX is not required to use React Everyone keeps repeating this, but looking at a pile of 'createElement' calls is so much harder to read than just looking at a page of html.

And so you introduce a simple build step to improve your development experience.

Re: What I wish I knew about React

#224
post #219
post #191

Earlier quoted context omitted.

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?

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

#225
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…

This is usually a smell that the person is competent at what they do, but doesn't know what's going on under the hood. Funny enough, I'd rather work with someone who doesn't know the specific technology, but knows what the language was built on top of, because they'll have a better intuition for how it actually works and be able to learn it relatively quickly.

Re: What I wish I knew about React

#226

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, d…

You could use an existing MVC framework such as this one: https://github.com/theabdulbari/mvc-router

Re: What I wish I knew about React

#227

Earlier quoted context omitted.

You can't do that. Just like you can't do: const [count, setCount] = useState(0); count = 1; In both cases, const is const. The fact that `setState` modifies state outside of the local scope does not mean that a local variable is not const. This is really basic programming, it doesn't have anything to do with React. Here's the exact same scenario without React to show why you're wrong in your original comment: const…

> This is really basic programming No, it's not. React is iterating that piece of code of your function internally to modify the value of the const, there is no other way to do it. And it is especially confusing because you can use that const 'variable' in the scope representing a changing value. And the change is magically made by its 'setState' method. If you do this yourself in a loop then it is of course totally…

I really recommend learning more about what you're complaining about before arguing with people about how you think something works.

Your jargon doesn't even make sense. "iterating that piece of code in your function"?

Put a console.log() at the top of your function and you'll see that it's simply being called many times.

Re: What I wish I knew about React

#228
post #219
post #191

Earlier quoted context omitted.

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?

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

#229
post #219

Earlier quoted context omitted.

What if most of TypeScript is embedded into the next version of JavaScript, as happened with Coffeescript?

Then there's not really a problem. You learned how it works, and now it's one less thing to worry about

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

#230
post #8

(Opinionated post ahead...) React is, imo, garbage, but alas it's here to stay -- you know, kind of like Spring or Swing. In 10 years we're going to be wondering how the hell we ever used React 8 hours a day way back then. These kinds of markup frameworks/libraries were touted as jQuery's successor, but, from an architectural point of view, jQuery is by far their superior. "Everything an HTML tag" is an insane mantra…

It's not made for "simple JS based apps", it's meant for large complex ones. Sounds like you're using React while you literally never had a use case for it. It doesn't mean it's garbage.
Post reply on HN