Skip to content

Combining Server-Side Rendering and Responsive Design #43

@anton-karlovskiy

Description

@anton-karlovskiy

@pi0 @danielroe cc @addyosmani

One of the pains I've experienced in SSR of Next.js is to realize responsive design without unnecessary DOM elements being rendered.
In this project, we have the same case.

Problems in universally rendered apps with conditional rendering in regard to the responsive layout

  • window.mediaQuery cannot be used since it's not available on server-side rendering and there would be a DOM tree mismatch issue.
  • Using CSS media query would result in rendering all of the elements regardless of whether they are used either on desktop or on mobile.

I think this article explains this well.

We managed to avoid rendering unnecessary DOM elements by using https://github.com/artsy/fresnel in the Next.js project.

@pi0 @danielroe Could you please suggest what to use in Nuxt.js? Thank you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions