reactjs javascript is mobile and desktop

JavaScript
const detectMobile = ()=> window.innerWidth < 768;
Source

Also in JavaScript: