how to know we are in mobile in reactjs code example Example: reactjs javascript is mobile and desktop const detectMobile = ()=> window.innerWidth < 768;