Hacker News new | past | comments | ask | show | jobs | submit login

React is a view layer tech

You should be persisting state in the Data layer on the client

The Data layer should be syncing with the servers or peer to peer once in a while




I don't think react claims to be "view" only anymore.


AFAIK, React does claim to solve "the view problem" and not more than that. You still need an architecture around your application if you're building something larger than a demo.

Quote from the React landing page:

> Design simple views for each state in your application

Quite literally, one of the selling points of React is that it's focused on the view based on data, not on where that data comes from.


localStorage is the data layer in this example. Components are the view. The hook is keeping the view and the data layer in sync.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: