| ▲ | igor47 3 hours ago | |
Wait but, don't you render the jsx to html? So you you can still perform the diff on the rendered html? Also, how do you know what you rendered last time? When you do the diff between what's in the browser and what the server just gave you, you have both sides. If you do it server side, you could... Render twice, once before and once after the state change? Or keep a server side cache? | ||
| ▲ | geon 2 hours ago | parent [-] | |
The server would keep a copy of the virtual dom during the session. Each change would be diffed and the diff sent to the client to apply. The client would only apply apply changes from the server, not change the dom on its own, so they wouldn’t get out of sync. I can render to html, but then I’d need to parse the html back do diff it. Seems stupid. I tried building a redux-style spa like that. Worked fine. https://github.com/geon/server-side-spa/tree/main/src/server | ||