Friday, May 19, 2023

[Re: structuring and working in React]

Jacob Paris has some hot takes on twitter:

"You probably don’t need - useEffect - Postgres - serverless - state management - dark mode"

State Management is an interesting one. (Especially given Paris' followup: "Not one person has tried defending state management - Truly a sign of the times") My first professional React project was making heavy use of Redux, but given its complexity... as soon as other alternates to bad old "prop drilling" (especially useContext) emerged, I'm not surprised they took over.

Looking over technologies that have come and gone, I've noticed that simplicity usually wins. Going way back, it (plus performance) is why Java EJBs flamed out - or more universally why JSON came in and wiped out use of XML in so much infrastructure. It is also why React muscled out Angular. (But the other part of that is, simplicity isn't enough if a framework isn't offering enough solutions, which is why Angular was previously able to gain traction in a JQuery-world.)

My hot take: I think more projects might do what Svelte is doing in terms of switching to JSDoc annotations vs TypeScript. You can read a response to the hub-bub that created... TypeScript can add a lot of visual complexity to function declarations and the like, and the errors and warnings it generates (especially when dealing with layers of React components that use polymorphism) can be arcane and difficult to interpret. I am not surprised that people are looking to alternatives for ensuring compile-time correctness.

Caveat: I know I am FAR more comfortable with duck typing than most of my peers. I'm certainly not calling for a return to the wild west of loose typing, but right now TypeScript doesn't feel like it has the simplicity that so many enduring technologies share. (Counterpoint disclaimer: TypeScript DOES seem to be firmly establishing itself as a de facto standards - much like React rose to predominance - and so this prediction might not be worth the paper it isn't written on.)

No comments:

Post a Comment