Relative Content

Tag Archive for reactjsnext.jsnext.js13

How to get the client side url in layout.tsx in Next 14 app router

import { headers } from ‘next/headers’; export default function Home() { const headersList = headers(); headersList.get(‘host’); // to get domain headersList.get(‘next-url’); // to get url return <div>….</div> } Geeting guys. I want to create a multi-tanent architecture saas application. Where I want to render a meta data based on the subdomain. For example: subdomain.trendspot80.tech i […]

Error: useMediaQuery is a client-only hook

I am trying to to create an app using NextJS 13.4.7 and am using useMediaQuery hook to detect if the view is mobile or not. My component is not a server component, but I keep getting client-only hook errors. Now my client component is a part of server component but from the documentation it seems that it is allowed. Am I missing something? Below is the code,