Simple example

To get some understanding about why it's not robust to rely on window.innerWidth property, take a look at this page

Lets configure deviceObserver with a few devices and its width and start observing when it is changed. Try to resize the window end check the logs below.

Desktop first

By default deviceObserver assumes that you use mobile-first approach. If that is not the case you can pass mobileFirst: false in the options to set your breakpoints strategy to desktop-first