State Is Things You Need to Track in Your Head
Keeping a copy of the server's data on the client adds another thing to reason about.
State is another thing you need to keep track of in your head.
State can be a pretty nebulous term in software. One way I think about it is as the extra things you have to hold in your working memory when you’re reasoning about a system.
Usually, you have data in a database on the server. The server uses that data to build a page and sends it to your browser. When you want an updated page, you refresh. The browser sends another request, and the whole page comes back from the server.
But say you want to update the data on the page without refreshing the whole thing. You keep a copy of that data on the client, then update it as the browser exchanges data with the server.
Now there are two places holding that data rather than one. There’s the database, and there’s the copy on the client. That client-side copy acts as a cache downstream from the database. If the data on the server changes, the copy on the client can be out of date until it gets updated.
This is where the extra state comes in: the extra things you have to keep track of. When you’re reasoning about the application, you have to think about what’s on the server, what’s on the client, and when the client gets updated.
Keeping that copy lets us update the page without a full refresh. And that’s another thing to hold in your head.