ReactTraining / react-media

CSS media queries for React

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why not just child elements?

richardzcode opened this issue · comments

Not an issue. Just curious why function as child plus render prop. Why not just child elements?

Isn't this easier to write, and easier to separate components base on viewport width?

<Media query="(max-width: 599px)">
          <p>The document is less than 600px wide.</p>
</Media>
<Media query="(min-width: 600px)">
          <p>The document is at least 600px wide.</p>
 </Media>

Just wanted to see if there is any downside of child elements I am not aware of.

Thanks,
Richard

Hey @richardzcode, please see my answer to this question in a similar issue from a few weeks ago

Hope that helps!

I see. Thank you!