'Can ResizeObserver listen just to width change?

I want to trigger ResizeObserver only on width change and not use it if height was changed. Is it possible?

Example:

const resizeObserver = new ResizeObserver(setLayout);
resizeObserver.observe(layout.current);

const setLayout = () => {/*do something*/}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source