2 ms·
> but the language, API or framework does not make it conducive to easily writing correct code The language is sort of settled. The browser runs JS, so for mos
by schwartzworld 1y ago
> but the language, API or framework does not make it conducive to easily writing correct code
The language is sort of settled. The browser runs JS, so for most projects, it's the right choice.
> If your large, complex, react app is slow - what is easier? Fixing the data architecture or adding a useMemo?
It might be easy to add useMemo, but it doesn't work. People using a tool for the wrong thing because they don't understand it isn't a problem with the tool. It's unfortunate that a tool with a steep learning curve is the "default" for many devs now, but again that isn't a problem with the tool. I don't have any guardrails keeping me from using my saw as a hammer, it just doesn't work.
> because something about language/framework/api makes doing the proper thing hard or unclear.
It's unclear because it was built on functional programming concepts and most devs aren't taught that way. If you are familiar with those concepts, the whole thing is quite simple.
- nemothekid 1y agoWe simply have different boundaries on whats a tool problem vs a developer problem. If the tool is easily misused, the tool is wrong. i.e. "You're holding it wrong" is a problem with the phone, not the user. >The language is sort of settled. The browser runs JS, so for most projects, it's the right choice. TypeScript exists. Something could be made that compiles to JS that makes this easier.
- schwartzworld 1y agoI've been using Typescript for years and while I love it, it's far from the magic bullet. No, you'd need something more opinionated and actually typesafe, and now you're writing a different language that compiles to JS. There's a bunch of these, and they haven't caught on for a reason. Eventually you're going to need JavaScript. There are more opinionated UI frameworks (angular) and frameworks with less magic baked into them (svelte, solid). React gives you the freedom to architect your app the way you want, for better or for worse. It was made by functional programmers to allow them to use composition and other FP paradigms in UI development. If you don't understand those concepts, or you just don't care for them, you're going to be swimming against the tide. Lots of tooling has been created to help those who do (Redux, for example). Maybe you're right and "you're holding it wrong" isn't a valid answer, but it's not React's fault it took over the world. It was made to do a certain thing, and it's pretty good for that. That thing requires a way to create side effects (useEffect) and a way to provide referential stability (useMemo, useCallback). The React team has done a lot to document the right way to use these tools. If it's not someone's thing, that's cool. If they are forced to use it at work, might as well learn a little FP and make life simpler.