Skip to content
Advertisement

Render div with state only on phones

is there some way how to render div conditionally with state but only for mobiles? I have show more button, but i need it only for phone resolution, also I need to display that div with className text every time on desktop

JavaScript

Advertisement

Answer

you can set the active class in the media query.

At first, you can this div display none. when your resolution is phone then you set display block.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement