We use the component ResponsiveSwitch to detect when a user is navigating on a small device and render the mobile version of the app. This component measures the width of the screen on componentDidMount.
On the serverside, NextJS never mounts the components so it assumes that the user is on a large device. However, we could make a better guess based on the user agent.
This should improve our page score on mobile and reduce the time to the first meaningful paint.
We use the component
ResponsiveSwitch
to detect when a user is navigating on a small device and render the mobile version of the app. This component measures the width of the screen oncomponentDidMount
.On the serverside, NextJS never mounts the components so it assumes that the user is on a large device. However, we could make a better guess based on the user agent.
This should improve our page score on mobile and reduce the time to the first meaningful paint.