以下の内容はhttps://tech.motoki-watanabe.net/entry/2020/10/17/165341より取得しました。


Next.jsで特定のディレクトリがPCのみの画面だとしたらSPではその画面ないので同等の画面にリダイレクトさせる

pageディレクトリがあったとして、ただその画面はPCでのみ存在し、SPではルートにリダイレクトさせたい。

react-responsiverouterでいけます

import { useMediaQuery } from 'react-responsive'
import Router from 'next/router'

export const page = (props: Props) => {

    const isSp = useMediaQuery({ maxWidth: 768px })
    isSp && Router.push('/')

    return (
        〜〜〜〜〜〜〜
        〜〜〜〜〜〜〜
        〜〜〜〜〜〜〜
    )
}



以上の内容はhttps://tech.motoki-watanabe.net/entry/2020/10/17/165341より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14