Server-side rendering + responsive design + inline styles -> which breakpoint to use? : <p>I have a responsive web application built with ReactJS for which I want one day to support server-side rendering. </p>

<p>According to the viewport size, the application layout/behavior changes. But all these changes can not only be done with plain CSS mediaquery: the JS behavior, and the underlying HTML structure also has to be changed according to the width. </p>

<p>For example I could have:</p>

<p><strong>Under 800px width</strong>:</p>

<pre><code>&lt;div class="app"&gt;
  &lt;div class="menu-mobile"&gt;...&lt;/div&gt;
  &lt;div class="content"&gt;...&lt;/div&gt;
  &lt;div class="mobile-left-menu"&gt;...&lt;/div&gt;
  &lt;div class="footer-mobile"&gt;...&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p><strong>Above 800px width</strong>:</p>

<pre><code>&lt;div class="app"&gt;
  &lt;div class="menu"&gt;...&lt;/div&gt;
  &lt;div class="main"&gt;
    &lt;div class="left-menu"&gt;...&lt;/div&gt;
    &lt;div class="content"&gt;...&lt;/div&gt;
    &lt;div class="right-menu"&gt;...&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="footer"&gt;...&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Now, I want to use server-side rendering for that application. But on the server I don't have the width, so I don't know which HTML structure to return to the client.</p>

<p>Note that I'm not looking for a solution that use a static default server-side breakpoint, and that on the client correct the app. I am looking for a solution that would return to the client the proper html structure according to its device. So it should work fine if he disables javascript on his browser.</p>

<hr>

<p>One could argue that I could render the html needed for both, and hide/show the required parts with plain CSS mediaqueries and <code>display: none</code>, but it would complicates the app and make it render a lot of unused html elements because generally it's unlikely that the user move above/under the breakpoint (I mean if he has a mobile device, the html elements for desktop will never be used)</p>

<p>Also, if I want to use inline-style, it becomes complicated because I have to render these inline styles for the correct width on the server.</p>

<p>I've <a href="https://github.com/reactjs/react-future/issues/8#issuecomment-53353098" rel="noreferrer">seen</a> some people are thinking about sniffing the browser UA to make an estimated guess of their viewport size. But even with some unsecure screen dimension detection, I'm not sure we can know the device screen orientation on the server-side.</p>

<p>Can I do anything to solve this problem?</p>
