Skip to content

Instantly share code, notes, and snippets.

View wolfcoder's full-sized avatar
💭
Full Stack Developer

Bams wolfcoder

💭
Full Stack Developer
View GitHub Profile
@wolfcoder
wolfcoder / useDeviceDetection.ts
Created October 22, 2024 07:49
React hook device detection
import { useState, useEffect } from 'react';
const useDeviceDetection = () => {
const [device, setDevice] = useState('');
useEffect(() => {
const handleDeviceDetection = () => {
const userAgent = navigator.userAgent.toLowerCase();
const isMobile =
/iphone|ipad|ipod|android|blackberry|windows phone/g.test(userAgent);
@wolfcoder
wolfcoder / useWindowWidth.ts
Created October 22, 2024 07:50
React Hook Use Window Width
import { useState, useEffect } from 'react';
const useWindowWidth = () => {
const [windowWidth, setWindowWidth] = useState(window.innerWidth);
useEffect(() => {
const handleResize = () => {
setWindowWidth(window.innerWidth);
};
{
"terminal.integrated.defaultProfile.windows": "Command Prompt",
"php.validate.executablePath": "C:/Users/bbg20/.config/herd/bin/php83/php.exe",
"json.schemas": [
{
"fileMatch": ["/package.json"],
"url": "https://json.schemastore.org/package"
}
],
"workbench.editor.enablePreview": false,