Post

In response to your recent tweet about useActionState: it surprised me that you — who work in the same company as the people who design the API — also struggle to see the `prevState`-argument. My question is, what do you think would be the "right" API? (I have opinions that I'll happily re-share)

I better understand the design now after posting that and asking more questions. Even though I'm at Vercel, I like to think of myself as community first – which to me means sharing how I'm learning as I go, and when things are confusing to me.

Almost every time I ask a question about a React API decision, there's tons of constraints I haven't thought about. I try to go in with an open mind.

I ended up chatting to Seb at the conf accidentally & way too late; I already had a few 🍻 & I hadn't thought about it for too long, but we had a good chat anyway (he is indeed amazingly smart) however .. (1/2)

My thesis is that if the abstraction was right - people wouldn't reach for tRPC still (selfishly, that's good, but I'd prefer if React got it right) - form libs wouldn't be needed (as often) - the 90% basic use-case of apps would have close to identical UX if JS was turned off in the browser

0 reposts5 likes

1) is not good signal. People use things for lots of reasons. Sometimes it’s because it’s better/easier, sometimes not. 2) is explicitly a goal. The primitives allow form libraries to be better, not replace them. 3) Also a non goal. No JS sucks so bad. The goal is supporting before JS.

The meta point I’d make about this feedback is like, if you don’t like these features as-is, then build an abstraction you do like. The new features exist to give you the capabilities to do that, not to be perfect on their own.

They’re also designed so that different abstractions can work together. If your app uses one form library, you should be able to install a dependency uses a different form library without conflicts.

0) Thanks for responding, I do appreciate your work & the time you're taking to respond. 1) I'm unsure what the bad signal is here(?), we're only trying to push some of what we've learned into React. We built tRPC to fill a void & we'll continue to improve/adapt it according to what y'all design.

there are forced abstraction in place to handle edge cases that don't affect most apps (and could be handled better by libs and app developers) that makes the UX and DX unnecessarily difficult

anyway, I know this is not for you to answer - I'm just venting once again. I should really do a long-form article on the subject to try to get a healthy discourse going, but it'll take a lot of [unpaid] time and effort that I don't have at the moment. 😅