renderToString defined multiple times #945

Closed
opened 2025-08-09 17:18:16 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @stsrki on 3/10/2017

In the ReactReduxSpa template renderToString function is defined in two places. Is this intentional? Wouldn't be better for the first renderToString to save the result in the variable and then pass it later as html parameter?

for example:

// Perform an initial render that will cause any async tasks (e.g., data access) to begin
const html = renderToString(app);

// Once the tasks are done, we can perform the final render
// We also send the redux store state, so the client can continue execution where the server left off
params.domainTasks.then(() => {
	resolve({
		html: html,
		globals: { initialReduxState: store.getState() }
	});
}, reject); // Also propagate any errors back into the host application
*Originally created by @stsrki on 3/10/2017* In the ReactReduxSpa [template](https://github.com/aspnet/JavaScriptServices/blob/dev/templates/ReactReduxSpa/ClientApp/boot-server.tsx) renderToString function is defined in two places. Is this intentional? Wouldn't be better for the first renderToString to save the result in the variable and then pass it later as html parameter? for example: // Perform an initial render that will cause any async tasks (e.g., data access) to begin const html = renderToString(app); // Once the tasks are done, we can perform the final render // We also send the redux store state, so the client can continue execution where the server left off params.domainTasks.then(() => { resolve({ html: html, globals: { initialReduxState: store.getState() } }); }, reject); // Also propagate any errors back into the host application
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#945
No description provided.