This I’m used window resize events which can have performance costs. I’ve just written a package which uses matchMedia for optimal performance npmjs.com/package/react-device-bre...
Simon - What would help everyone is if you could explain the "performance costs" you quoted here.
BTW, as much as I wish my best for the commendable work you've put in your lib, I don't appreciate you promoting it here. If you wanted to improve this lib, you could've created an issue and we could have worked on it together. But if you want to promote your lib by dismissing what I've built, I don't appreciate it.
Sorry, the package I wrote came out of a problem I was trying to solve at work. All the responsive packages out there test breakpoints based on window size, meaning they listen to the window resize event which can have performance costs, then if you denounce you can get weird jumping of content.
My approach uses match media which is native to the browser and listens to the change event for each media query which is far more performant.
Was just letting people know there is an alternative approach, wasn’t down playing anything you had written.
I had already written my package and came across this post later.
I think it would have been a hard one to contribute to just because the approaches are completely different.
Sorry didn’t mean to tread on anyone’s toes. My original post was brief just because I was out and about so didn’t have time to write a detailed explanation
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.