How to prevent downloading the desktop component code in Next.js when using dynamic imports based on user-agent?
I’m trying to create a layout in Next.js where the component rendered depends on the device (mobile or desktop). I want to prevent the desktop layout’s source code from being downloaded to the browser if the user is on a mobile device. Here’s what I have: