@mwap

Custom Document

MWAP uses the Document component when creating the final SSR HTML response. You can override it by creating either a document.tsx, document.ts, document.js, or document.jsx.

Overriding the Document allows you to do things like:

  • Add meta to the document
  • Add global styles / scripts

A custom document.tsx might look something like:

import * as React from "react";
import { Body, Head, Html } from "@mwap/server";
const Document = () => {
return (
<Html>
<Head>
<meta charSet="utf-8" />
</Head>
<Body>
<script async src="https://api.countapi.xyz/hit/mysite.com/visits" />
</Body>
</Html>
);
};
export default Document;

Related

For more information on what to do next, we recommend the following sections: