Recently diving into Next Js and TypeScript, I encountered the following error:
Unhandled Runtime Error
TypeError: this.context is null
Here's a snippet from my Layout.tsx file:
import { FC } from 'react'
import { Head } from 'next/document'
import { Box } from '@mui/material'
interface Props {
title?: string;
children?: React.ReactNode;
}
export const Layout:FC<Props> = ({ title = "Open Jira", children }) => {
return (
<Box sx={{ flexGrow: 1 }} >
<Head>
<title>{ title }</title>
</Head>
<Box sx={{ padding: '10px 20px' }}>
{children}
</Box>
</Box>
)
}
Could this error source from a TypeScript issue or is it related to Next.js?