Refactor server-rendered tags. Closes #2246

This commit is contained in:
Gabe Kangas
2022-10-22 16:51:05 -07:00
parent 0ae4b542b4
commit 8aed27e44d
3 changed files with 49 additions and 53 deletions

View File

@@ -1,10 +1,14 @@
/* eslint-disable react/no-danger */
import { FC } from 'react';
export type ServerRenderedHydrationProps = {
hydrationScript: string;
};
export const ServerRenderedHydration: FC<ServerRenderedHydrationProps> = ({ hydrationScript }) => (
// eslint-disable-next-line react/no-danger
<script dangerouslySetInnerHTML={{ __html: hydrationScript }} />
export const ServerRenderedHydration: FC = () => (
<script
id="server-side-hydration"
dangerouslySetInnerHTML={{
__html: `
window.configHydration = {{.ServerConfigJSON}};
window.statusHydration = {{.StatusJSON}};
`,
}}
/>
);