The vast majority of state problems in React are a result of nonsense cargo culting around the idea that classes are somehow bad.
In React {Transitions} = F(state)
11–20 of 55 posts
Re: In React {Transitions} = F(state)
#12Every time I delve into a large React codebases (and I have worked on some real monsters) I have a laugh to myself at how badly these guys tie themselves up in knots in order to preserve the supposed simplicity of the state -> UI function. When you invent something as insane as the hooks API in order to maintain purity it's time to step back and consider if you're really on the right track.
Hooks are the best thing for frontend dev since async/await.
Re: In React {Transitions} = F(state)
#13I might just not be aware of a better alternative for React hooks, but I don't like useEffect. I feel like it makes it much more difficult to manage state and transitions compared to SolidJS or other frameworks that use signals.
Re: In React {Transitions} = F(state)
#14Of course many actions logically cannot be made idempotent, but for the subset that can, do it as much as possible.
Re: In React {Transitions} = F(state)
#15Re: In React {Transitions} = F(state)
#16> A React application can be thought of as modeling a state machine. Each render takes a state and produces the UI for that state. This is the famous UI = f(state) mental model of React. But, for complex applications, formally enumerating a transition table is often not feasible. When the number of possible states is not finite, a table will not suffice and we must instead define a mapping: a conceptual function whic…
And yet, it's extremely common to see apps with clearly broken states and state transitions for what should be relatively "trivial" state machines. Think play/pause buttons, buttons with loading states, form fields with error states, etc.
Re: In React {Transitions} = F(state)
#17The vast majority of state problems in React are a result of nonsense cargo culting around the idea that classes are somehow bad.
Re: In React {Transitions} = F(state)
#18Re: In React {Transitions} = F(state)
#19Every time I delve into a large React codebases (and I have worked on some real monsters) I have a laugh to myself at how badly these guys tie themselves up in knots in order to preserve the supposed simplicity of the state -> UI function. When you invent something as insane as the hooks API in order to maintain purity it's time to step back and consider if you're really on the right track.
Hooks are the best thing for frontend dev since async/await.
It has a lot of expressivity but is incredibly brittle and dangerous.
Re: In React {Transitions} = F(state)
#20The cost of a round trip for every UI interaction might seem high, but I've never seen a distributed client/server state machine model that could compensate for any of these alleged UX harms without simultaneously bringing in more complexity than anyone was prepared to deal with.