Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah. So in my experience “state” based UI really pushes your app towards “real-​time”, almost like a multiplayer game. Given that your entire UI is rendered from a certain set of data, you definitely don’t want to be in a position where you are personally reconciling the data structure in the browser with data received from the server.

In my view it’s best for when you can directly tell the server, “here’s my latest data”, or ask the server: “What’s up? What’s the latest?” Think Gmail, or Facebook comments. So it’s okay if the two states (server vs. client) get out of ‘sync’, to support something like Offline Editing, but the data received should be in an expected structure.

Oddly, a simple and clear way to think about this is that it's similar to server-side templates. You instantiate your variables first, then just run the rendering function. If the rendered view has to change it's still based on conditions or booleans held in your variables; you change them and run the rendering function again. That's how server-generated HTML works.



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

Search: