Skip to content

Commit

Permalink
feat: use renderToStaticMarkup
Browse files Browse the repository at this point in the history
  • Loading branch information
ooooorobo committed Oct 29, 2023
1 parent 926a37d commit a3952fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/renderer.tsx
@@ -1,5 +1,5 @@
import React from 'react';
import { renderToString } from 'react-dom/server';
import { renderToStaticMarkup } from 'react-dom/server';
import { Store } from 'redux';
import { App } from './view/App';
import { NotFoundPage } from './view/pages/404';
Expand Down Expand Up @@ -51,19 +51,19 @@ export const renderer = ({
store: Store;
} & AppProps) => {
try {
const content = renderToString(<App store={store} {...props} />);
const content = renderToStaticMarkup(<App store={store} {...props} />);
return defaultHtml(props.assetPath, content);
} catch (e) {
return renderNotFound(props);
}
};

export const renderNotFound = (props: AppProps) => {
const content = renderToString(<NotFoundPage {...props} />);
const content = renderToStaticMarkup(<NotFoundPage {...props} />);
return defaultHtml(props.assetPath, content);
};

export const renderExpired = (props: AppProps) => {
const content = renderToString(<ExpiredPage {...props} />);
const content = renderToStaticMarkup(<ExpiredPage {...props} />);
return defaultHtml(props.assetPath, content);
};

0 comments on commit a3952fa

Please sign in to comment.