yocontra / react-responsive

CSS media queries in react - for responsive design, and more.
https://contra.io/react-responsive
MIT License
7.04k stars 298 forks source link

Code duplication on using MediaQuery with components #234

Closed dcipher00 closed 4 years ago

dcipher00 commented 5 years ago

On using media query with components we need to specify <MediaQuery maxDeviceWidth={***}> for small devices and <MediaQuery minDeviceWidth={****}> for large devices to distinguish between device width for example <MediaQuery maxDeviceWidth={464}> and <MediaQuery minDeviceWidth={1224}> to distinguish between device width of 464 and 1224

yocontra commented 5 years ago

There are two alternative ways you can do this, either using render function children or hooks (both documented in the README).

If you have an alternative suggestion for an API let me know, otherwise will close this.