logoalt Hacker News

adamzwassermanlast Thursday at 5:30 PM2 repliesview on HN

The state encapsulation concern is exactly what DATAOS addresses: dataos.software

The premise is that React's "UI=f(state)" creates a synchronization problem that doesn't need to exist.

If the DOM is the authority on state (not a projection of state held elsewhere), there's nothing to sync. You read state from where it already lives.

I built multicardz on this: 1M+ cards, sub-500ms searches, 100/100 Lighthouse scores.

If you have time to read, I would very much like to hear your thoughts; genuine technical pushback welcome.


Replies

johnfnlast Thursday at 6:13 PM

I would be happy to discuss more. I am genuinely curious (though I do hold a pretty strong belief that React is a good abstraction).

When you say that the DOM is the authority on state, I’m not sure if that addresses my concern. Let’s revisit my example of the button. Image I look at the DOM and see that it’s in a “Submitted” state, and I think that’s a bug. How can I determine how it got into this buggy state? The DOM can’t answer that question, as far as I can see, because it is only an authority on the current state of the system at this exact moment. The only way I see you answering this question is by scanning every single API endpoint that could have plausibly swapped out the button for its new state - which scales at O(n) to the side of your repository! And if one API could have added HTML which then added more HTML, it seems even worse than that.

The advantage of React is that you get a crisp answer to that question at all times.

> I built multicardz on this: 1M+ cards, sub-500ms searches, 100/100 Lighthouse scores.

I believe you! But I am more concerned about readability. React makes some tradeoffs, but to me readability trumps all.

show 1 reply
lbreakjaiyesterday at 3:14 AM

> If the DOM is the authority on state (not a projection of state held elsewhere), there's nothing to sync. You read state from where it already lives.

But it's not, is it? The state lives in the server. If I open a page, and let it open for 2 hours, then there's no guarantee it actually represents the current state.

show 1 reply