Chapter 10. Serializing, Deserializing, and Attaching
Essentially, the application should take the server-rendered markup and bind itself to the markup just as if it had been rendered on the client like an SPA. This means that any data used to render the controller response on the server should be available on the client, so that when a user starts interacting with an application she is able manipulate the data, e.g., via a form. Any DOM event handlers will need to be bound as well, to facilitate user interaction. In order to “rehydrate” on the client, four steps must be completed:
Serialize the data on the server.
Create an instance of the route handler controller on the client.
Deserialize the data on the client.
Attach any DOM event handlers on the client.