React Server Components - First Impressions
Today the React community released React Server Components. This RFC is not intended to completely replace the idea of server-side-rendering, but rather enhance it by rendering portions of the application both on the server and on the client.
How is state managed?
The sample application does not have have complicated state management. Looking into the codebase, state is managed through GET requests to a /react
endpoint. The example request in this flow passes the selected item, editing state and search text. {"selectedId":5,"isEditing":false,"searchText":""}
The response is using a custom header, X-Location, to convey state through a JSON string to the client. In the example the X-Location is returning the same value as the request. This object is then passed into the root application as props.
This approach works for a small, single object, single view example. However, looking at larger applications with more complexity this might be difficult to manage.
Notes
My fork here