slate/pages/_document.js
Aminejv 0c4ecd9025 feat(modals): add portal to display modals in
- feat(_document): render portals in the div element with id browser_extension

- feat(ModalPortal): useReactDom.createPortal to render childrens
2021-09-17 14:44:29 -07:00

27 lines
709 B
JavaScript

import Document, { Html, Head, Main, NextScript } from "next/document";
class MyDocument extends Document {
static async getInitialProps(ctx) {
const initialProps = await Document.getInitialProps(ctx);
return { ...initialProps };
}
render() {
return (
<Html>
<Head />
<body>
{/** NOTE(amine): used to communicate with the extension via classNames.
* e.g. if the extension is installed on the user's browser, it will add 'isDownloaded' to className*/}
<div id="browser_extension" />
<Main />
<div id="modals_portal" />
<NextScript />
</body>
</Html>
);
}
}
export default MyDocument;