to determine is a device is a mobile or not javascript react code example Example: reactjs javascript is mobile and desktop const detectMobile = ()=> window.innerWidth < 768;