I'm using next.js to create a static page that outputs in SSG mode.
I would like to use the react-device-detect library to determine the output component based on the screen size.
Since the page is created as SSG, even if the screen size is changed after accessing the page, the components will not be changed in real time.
Of course, if you change the screen size and reload it, it will be reflected, but I want to reflect it in real time.
If next.js is not used and only react is used, it will be rendered each time, so there was no problem. Is there a solution to this point?
Best regard.
The source is below.
import { isMobile, BrowserView, MobileView } from "react-device-detect";
const Header = ({ pathname }) => (
<header>
{isMobile ? "mobile header" : "header"}
<BrowserView>normal</BrowserView>
<MobileView>mobile</MobileView>
</header>
);
export default Header;