Determines if the current window width is considered mobile.
This function checks if the code is running in a browser environment and then
evaluates the window's inner width to determine if it is 768 pixels or less,
which is commonly used as a threshold for mobile devices.
do not use it if you have an other option
Returns boolean
true if the window width is 768 pixels or less, otherwise false.
Example
importisMobilefrom'./is-mobile';
if (isMobile()) { console.log('The current device is a mobile device.'); } else { console.log('The current device is not a mobile device.'); }
Determines if the current window width is considered mobile.
This function checks if the code is running in a browser environment and then evaluates the window's inner width to determine if it is 768 pixels or less, which is commonly used as a threshold for mobile devices. do not use it if you have an other option