React- simple solution to check screen width/height?

Newbie here. Is there a simple solution to check the screen width/height in React? To be more exact, i want to know if the screen is landscape, or portrait and arrange my components based on this

Would this do it?

CSS also offers the ability to do media queries based on orientation:

1 Like

Oh wow, there is even an orientationchange event and a Screen.orientation property, though the latter is somewhat experimental.

hi, thanks for the suggestion, ill try the window.innerWidth and innerHeight methods

i know, i did find that solution, but i try to run bootstrap classes and styles in my react app and the logic needs to be part of the js code, not the css sheets. Im unsure if there is convenient way to make a css media query and toggle it off/on in react

with some tweaking i seem to be able to use this approach to cover my needs