Earlier quoted context omitted.
Yeah and then the router sends you property changes which you react to with useEffect().
The whole point is not to use it directly in your components. It is implementation detail of that particular router. You might use router that interfaces with Redux not React directly. Or you could write your router in the form of a service that lives directly in the history api event handlers and communicates directly though react state setters of some top-level component. Not a single useEffect needed. Besides, rou…
Kind of annoyed at React
121–130 of 135 posts
Re: Kind of annoyed at React
#122"Don't load data in useEffect!"
Okay, but [this and that and this] so how should you actually do this?
"Oh, use useEffect duh! We meant.. Don't, like, use it too much."
"And React function components should always be pure!"
Wait, aren't the hooks storing and mixing states into the function in a way that's almost creating a sorta sudo object? How is that pure?
"No, we mean 'they are pure!' when we want to be dismissive. Of course they are not really "pure".."
Edit: The one weird trick they don't want you to know and will have all the React CRUD kiddies screeching; Use useMemo to kick off work early ;)
Re: Kind of annoyed at React
#123Alongside the work on server components, they also deprecated Create React App, which was previously the official way to create new apps for development, and which had pretty good ergonomics. However, you won't find that documented on the actual CRA site - when you go looking for why your dependencies are out of date, you'll find references in obscure GitHub issues: https://github.com/reactjs/react.dev/pull/5487#issu…
Vite is the new unofficial CRA. Superior in nearly every aspect.
Similar to how Tanstack Query doesn't even mention MobX as a state management library. It's crazy how many people use MobX for beefy apps(even Microsoft use it) but how little attention it gets.
Re: Kind of annoyed at React
#124Alongside the work on server components, they also deprecated Create React App, which was previously the official way to create new apps for development, and which had pretty good ergonomics. However, you won't find that documented on the actual CRA site - when you go looking for why your dependencies are out of date, you'll find references in obscure GitHub issues: https://github.com/reactjs/react.dev/pull/5487#issu…
Totally agree with your point about node backends. So much of the world doesn't and is not going to have their backend entirely or partially on node. But to the authors point, Vercel is Reacts daddy now and daddy needs to sell some hosting(for a new pair of shoes).
Re: Kind of annoyed at React
#125I sorta feel the same way. I used to be excited to spin up a react project, and loved working with it daily for 8+ years. It really was wonderful. Junior devs used to be able to write clear, performant, bug free code in react without a ton of hand holding. One of its greatest testaments. Now you need to spend 20 minutes figuring out what someone is trying to accomplish with a useEffect hook with 10 dependencies and i…
Re: Kind of annoyed at React
#126Earlier quoted context omitted.
Vite is the new unofficial CRA. Superior in nearly every aspect.
But they pretty much snubbed Vite because it's not a "framework". Similar to how Tanstack Query doesn't even mention MobX as a state management library. It's crazy how many people use MobX for beefy apps(even Microsoft use it) but how little attention it gets.
I quickly evaluated zustand and liked the hook based API much better than mobX. Feels even more lightweight than mobX.
Re: Kind of annoyed at React
#127React is fundamentally bad technology. I know there are historical reasons for the virtual dom but the reasons that justified it don't exist anymore. If you want to do anything interesting with react that involves interacting directly with browser APIs you need to deal with these absurd use effect hoops to initiate state with references to dom nodes. I've worked on 4 large react code bases and they always devolve int…
> they always devolve into these blobs of non-deterministic async state with unpredictable performance Exact same experience here. I've been banging this drum for years. When hooks came around I thought they might make it better, but alas, we are still in a downwards spiral. Building web apps is 10x more complicated today than it was ten years ago, with nothing to show for it. I'm happy to see some known voices in th…
Re: Kind of annoyed at React
#128It is ridiculous to suggest that React is worse today than ten years ago. Remember all that time people spent battling their build scripts? Or what about the obtuse 3rd-party state management libraries everyone used to augment class components? It was torturous from the start.
I don't see where that was suggested. He's been using it 10 years. He doesn't like the way things are currently going.
Re: Kind of annoyed at React
#129Earlier quoted context omitted.
But they pretty much snubbed Vite because it's not a "framework". Similar to how Tanstack Query doesn't even mention MobX as a state management library. It's crazy how many people use MobX for beefy apps(even Microsoft use it) but how little attention it gets.
MobX is awesome, but I never really liked HOCs. Recent React apps I made didn't have any global state management, there was no real need for it. I quickly evaluated zustand and liked the hook based API much better than mobX. Feels even more lightweight than mobX.
It works with Vue, React, Solid, and nothing. So it's there for me and allows for multi-view-library pages backed by the same stores.. Niche, but clutch for certain extensible apps.
Re: Kind of annoyed at React
#130Earlier quoted context omitted.
The whole point is not to use it directly in your components. It is implementation detail of that particular router. You might use router that interfaces with Redux not React directly. Or you could write your router in the form of a service that lives directly in the history api event handlers and communicates directly though react state setters of some top-level component. Not a single useEffect needed. Besides, rou…
Okay, but my point is that somewhere along the line there always is a useEffect() that reacts to something. Maybe it's in your own component, maybe it's in a third party component.
You don't need useEffect() to react to anything. React itself reacts to state and props change.
You'll do yourself a favor if you ban yourself from using state setters inside useEffect(). Try it.