2 ms·
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 on
by EGreg 7y ago
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
- ramenmeal 7y agoI don't think react claims to be "view" only anymore.
- capableweb 7y agoAFAIK, 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.
- brlewis 7y agolocalStorage is the data layer in this example. Components are the view. The hook is keeping the view and the data layer in sync.