News for hackers. Stuff that matters.
Re:Understanding UseMemo and UseCallback by boredtofears on Tuesday August 30, 2022 @11:42PM (#32658129)
> as soon as juniors in my work are involved I have to spend a lot of time reviewing PR's, fixing changes and explaining concepts in order to make sure that the application actually runs correctly

I've never worked on a codebase where this isn't true regardless of what frameworks or libraries are used - that's kinda part of the gig.

Re:Understanding UseMemo and UseCallback by amand33p on Wednesday August 31, 2022 @02:51AM (#32659185)
Exactly. I don't know why people pick on only React for this. Any un-opinionated library or toll will have the same problem.
Re:Understanding UseMemo and UseCallback by solardev on Wednesday August 31, 2022 @03:08AM (#32659274)
IMHO (only), React is a bit too flexible/modular/unopinionated and asks you to reinvent a lot of wheels... everything from basic page routing to syncing ajax calls to loaders and states, etc. More opinionated or bolts-included frameworks have defined conventions that you're strongly encouraged to adhere to, and they work great for most use cases. And when you see that pattern again, you know what the intent is.

But with React, every dev ends up doing the same thing their own way, with subtle differences and subtle bugs, and then as turnover happens and frameworks become less fashionable, codebases get polluted by a mix of different dev and tool generations and it gets even harder to ensure correctness.

Using a more opinionated framework built on top of React, like Next.js, can solve a lot of those issues... until Next itself becomes unfashionable and the cycle starts again :(

Re:Understanding UseMemo and UseCallback by scrollaway on Wednesday August 31, 2022 @05:10AM (#32659994)
Yeah React is not meant to give you this layer. NextJS indeed does. Why do you care if it becomes unfashionable in the future? Pick one tool that fits your use case and run with it for its lifetime. If you need to learn something else 5 years from now, learn something else. I’ve been in software for two decades almost, I’ve always had to learn new frameworks and libraries, part of the job isn’t it?
Re:Understanding UseMemo and UseCallback by solardev on Wednesday August 31, 2022 @10:44AM (#32662673)
It's not that I mind learning new things, it's that React is so barebones everyone tries to make it complete by adding different things. One person likes redux, another mobx, another context... some like class components and others like functions, some use libraries and other use frameworks, etc. Sometimes all in one codebase if it's old enough. It's a lot harder to maintain over time than a more opinionated framework. I wish Angular won out, myself.
Re:Understanding UseMemo and UseCallback by boredtofears on Wednesday August 31, 2022 @02:21PM (#32666246)
It's all just javascript at the end of the day. What you're describing is exactly why many people like React.

> It's a lot harder to maintain over time than a more opinionated framework.

That's not true at all, that depends on the quality of the codebase the exact same as if it were built on an opinionated framework. I've seen plenty of bloated Rails codebases that were miserable to maintain.