✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🧬 Learn how to build RNA-Seq data apps with Python & Dash. Register for the May 20 Webinar!

Screen Size Media Query Component?

Has anyone created or is it possible to create a component that preforms JavaScript media queries and the user’s screen size could be used as an inputs or states to callback functions?

The use case I’m imagining would be to have the user’s screen width as a callback state and return different children to a component depending on whether they were on mobile or a larger screen. The data table can get a little unwieldy on mobile devices.

The best way to do this would be to use CSS - Add a class name to the data table and set display:none when the screen is small inside a media query.

I believe you are correct here with some additional thought. With server side pagination the penalty is low for sending the same data to two different elements. I’ll give it a try. Thanks!