Hacker News new | ask | show | jobs
by conorgdaly 2259 days ago
> All the hidden “ready to be inserted into the DOM” elements also need server side code to re-render things the same way.

There seems to be some confusion. With your list example, you still make an ajax call to create a new ToDo, the server returns html which is inserted into DOM.

You'll be making an ajax call anyway, except instead of just 200 reponse/json , you'll get html. This is server side rendered. There is no """hidden “ready to be inserted into the DOM” elements"""

Yes, forms are something which, depending on complexity, can be better served with SPA type solution.

If it's not complex, I'd still keep rendering server side and just add small bit of JS logic to update form header to add/remove to error list and just replace form input field with server response.

1 comments

Yeah, the TODO list example probably isn't a good example for a complicated scenario when avoiding server side templating makes sense.