Live data from Hacker News

React is holding me hostage

emnudge.dev

371–380 of 553 posts

Re: React is holding me hostage

#371
post #93

As a more backend guy who does some frontend, the main thing I like about React over alternatives like Svelte, Vue and SolidJS is React Native. React is maybe not perfect for the web, but it’s very, very good, and it’s also quite good for mobile via React Native. The more purely web-focused libs/frameworks have far inferior (or no) mobile options, while other cross-platform frameworks, like Flutter, suck on the web.…

Is React good on mobile or does it just have a good solution there? I don’t think anything is stopping vue-native from popping up other than interest and someone to work on it.

TLDR: React Native sounds incredibly awesome until you are 5 years and 150 devs into it and realize that this shit sucks.

But hey, if you are under 10 people and need apps everywhere, it is a nice thing.

Re: React is holding me hostage

#372

Earlier quoted context omitted.

Your dislike for ‘templates’ is much more a matter of personal preference than you’re letting on. Using language like “still using templates” makes me think that you don’t see any valid opposing view. I do not like JSX. It’s not worth talking about why. It’s not an argument I want to have. But framing non-JSX approaches as objectively inferior is not in tune with the reality, being that this is something sensible peo…

> Templates are a no go for me It’s pretty hard to get more “this is my opinion rather than a statement of objective fact” than this. > I do not like JSX. It’s not worth talking about why. It’s not an argument I want to have. Ok. Um… well, it’s hard to have a discussion if you won’t talk about it… …but, “code” templates allow autocomplete and type checking in a way that is an objectively distinctive superset of text…

Strongly agree. I just don’t get the hate for JSX.

JSX is objectively better than than the scores of templating systems out there. You get much more: type checking, use of JS for logic, and no need to learn yet custom arcane syntax. If anything, I think JSX is not used and supported enough.

In the general sense, JSX is just syntactic sugar for function composition. That it works well for html-style components is a side effect; it could certainly be used for more than that.

I wish languages like Typescript would support JSX natively, with absolutely to dependency on any React-like library. Let me declare a function using JSX, e.g.,

    type Mode = “upper” | “lower”
    const capitalize = (str: string, mode: Mode) => mode === “upper”? str.toUpperCase() : str.toLowerCase()
    const join = (mode: Mode, …arr: string[]) => arr.map(str => ).join()

    const joined = Bon Jovi /> // “bonjovi”

Re: React is holding me hostage

#373

I'm still a React guy. I've also worked with Angular and Vue and toyed with Svelte. People tend to compare these frameworks on things that don't matter - often it's performance. We used to compare React performance to AngularJs performance too, which was meaningless. VDom is nice. Reactivity in signals is nice. Limiting rerenders is nice. But I choose frameworks because of developer ergonomics. The killer feature for…

> things that don't matter - often it's performance

You're a react guy, alright.

Re: React is holding me hostage

#374

Earlier quoted context omitted.

And I never click on Ads. Yet they work and drive a lot of traffic and money to sites. (Even after all the fraud) Products almost never compete on performance, and the biggest, most popular ones are almost always the slower ones. Regardless of your anecdotal evidence, there is a reason why this sentiment is prevalent in the industry - because PMs and devs who thought otherwise were quickly outcompeted by those that m…

Performance is obviously important, to suggest otherwise is just silly. Both Google and Amazon have researched this topic and the results are readily available. First link I found: https://www.thinkwithgoogle.com/marketing-strategies/app-and... Why do you think there some much time and effort going into improving performance of computing in general. Facebook Lite, android go, GPU's, cpu improvements, 5g, etc. The imp…

Performance is usually a lower order concern than an app doing what you want. You can bail on a slow app because you're impatient all day long, but if it's the only way to do the thing you want to do, I 100% guarantee you're going to suck it up and use the app.

Re: React is holding me hostage

#375

Earlier quoted context omitted.

JSX forces you into small tiny components because anything of any decent size becomes unmanageable. There's way too much mixing of JS into the template. Vue you can do Submit In React I've seen people do: if (!props.isFormValid) { return Submit ; } return Submit ; This is just an example, obviously you can write this better in React. My point is there's /always/ so much conditional markup like this in every react pro…

> return Submit ; In JSX, the "disabled" attribute is a boolean; so it would be just: return Submit ;

Incredibly this is more readable than the Vue example given as a reason why Vue’s syntax is better!

Re: React is holding me hostage

#376

Earlier quoted context omitted.

> return Submit ; In JSX, the "disabled" attribute is a boolean; so it would be just: return Submit ;

> This is just an example, obviously you can write this better in React. The issue is people write SO much conditional logic into their react templates. Not that disabled is boolean and can be written better.

Trying to be fair here, but what about vue makes it less likely that you won't put the same conditional logic into your vue template? If it's just impossible, then you're saying the framework is more limited, which is fine but sometimes you want flexibility.

This seems to be a 'best practice' issue as well that can be avoided through PR review. My team has been putting logic more and more into local hook files to keep components clean.

Re: React is holding me hostage

#377

I don't understand the animosity around useEffect. It executes a function based on a list of dependent variables. That's it. Once you understand that, its purpose becomes very clear. You don't want to rerender? Use useEffect with an empty array! Or don't use any state variables! You want to show something new to your customers / users without rerendering? Well sorry, that's impossible, regardless of any framework you…

> I've been writing React for 6+ years now and have NEVER had to reach for useMemo or useCallback.

Wha- how?! The moment a useEffect depends on a callback, it needs to be memoized!

Re: React is holding me hostage

#378

I never understood why React became so popular. I thought it was a kind of mass hysteria. I was exposed to a broad range of front end frameworks early in my career (Backbone, SproutCore, JavaScriptMVC/CanJS, AngularJS), one of my colleagues was experimenting with Google's PolymerJS and recommended it. After trying it out, I was blown away by its elegance and simplicity. Yet somehow it never caught on. When React came…

My favorite comment on this thread, for the last paragraph if nothing else.

Re: React is holding me hostage

#379

Earlier quoted context omitted.

Performance of frameworks is often irrelevant for products/applications. 1. Performance is very very rarely a contributor to a product success. Users prefer more features over more performant app all the time (both directly when asked and indirectly by what products they choose). 2. Rendering/client computation speed is rarely a contributor to real and perceived performance. It's almost always the async calls - how m…

> Performance is very very rarely a contributor to a product success. Users prefer more features over more performant app all the time (both directly when asked and indirectly by what products they choose). I close sites all the time when they fail to work quickly. I have aborted orders on sites midway through when the interaction became sluggish enough that I wasn't confident in the value of the product anymore. Thi…

Performance obviously matters, but only to the extent that everyone has a threshold for how much sluggishness they're willing to tolerate. For the majority of use cases, React is performant enough that devs don't have to go out of their way to optimize anything.

Re: React is holding me hostage

#380
post #59

Earlier quoted context omitted.

> In functional programming, functions are not allowed to do that. The only thing a function is allowed to do is return a value. Oh, yes, they are allowed to do that. You capture the effects into a list, and return the tuple of list and return value. If you feel like it, you wrap that into a monad to pretend you are only "returning" a single thing. > In FP functions can only rely on the parameters passed to it (it ca…

I think you may be missing the forest for the trees. The point of FP is that you can glance at a function and say 'this is obviously correct' without having to work out the state and context of every call.

No. The point of FP is "minimize state and effects so that the code is easier to understand", not "write it in FP style so that by magic is correct".

For exactly the same reason OO is "put the code that manages the state near to the state and split it in manageable parts" and not "dog inherits from animal therefore the code is correct".

Leave the faith at the church and approach code with science.

Post reply on HN