Getting Started

Server setup

Edit this page

For server setup, wrap your application with MetaProvider on the server. This component uses a tags[] array to pass down your head tags as part of your server-rendered payload. Once rendered on the server, the component updates this array to include the tags.

import { renderToString, getAssets } from "solid-js/web";
import { MetaProvider } from "@solidjs/meta";
import App from "./App";
// ... within the context of a request ...
const app = renderToString(() => (
<MetaProvider>
<App />
</MetaProvider>
));
res.send(`
<!doctype html>
<html>
<head>
${getAssets()}
</head>
<body>
<div id="root">${app}</div>
</body>
</html>
`);
Report an issue with this page