How do I detect I am on server vs client in Next.js

后端 未结 4 1598
予麋鹿
予麋鹿 2021-01-01 09:10

I am using a customer express server with Next.js. It\'s running within a container. I am doing an http request with isomorphic-fetch to get data for my render.

4条回答
  •  感情败类
    2021-01-01 09:42

    Now (2020 Jan) it should be typeof window === 'undefined' since process.browser is deprecated

    Refer to https://github.com/zeit/next.js/issues/5354#issuecomment-520305040

提交回复
热议问题