It is sometimes helpful to know the responsive breakpoints in JavaScript to tweak and run the logic depending on the screen size.
We will be creat...
For further actions, you may consider blocking this person and/or reporting abuse
I would prefer making this more general by taking a configuration object with the desired sizes:
Cool! Additionally, the way you used
Object.values + find + map
, refreshed usage of few concepts which I knew but rarely put in practice. Thanks.My aproach is this way: (Someday I'll publish my hooks xD)
So, you can use like this:
Wow this is an comprehensive one. I think I should sit back and give time to imagine all use cases it covers.
Hi,
I am just wondering why you use matchMedia instead of all these complex calculations? media queries in JavaScript too matchMedia
Thanks
Stefan
First time heard about the matchMedia. Thanks for the input.
Just wondering, is there any way to react if screen resized?
Of course, it has an event receiver for onChange.
developer.mozilla.org/en-US/docs/W...
that's cool!
Hello,
I am new to React and have never used a custom houk. It seems to me that I understood how your code works, but I don't quite understand how to build the logic on a component in order to return inside the choice of 2 components like the navigation bar. Ex: I have a global topBar container, and I have 2 components to return, either a dropdownMenu or from the large tablet, bring up the other navigation component navMenu.
How can I implement the logic against the code you offer?
Thank you.
Thank you very much. I was reading this article and blessing you from Perú, keep going :)
Thanks for your kind words, Favio😊
This does not work on page reload on mobile devices or when you go from one page to another page in mobile device. It returns infinity value in that case.