Skip to content

Instantly share code, notes, and snippets.

View LishuGupta652's full-sized avatar
🎯
Focusing

Lishu Gupta LishuGupta652

🎯
Focusing
View GitHub Profile
@LishuGupta652
LishuGupta652 / useScroll.js
Created April 16, 2020 20:27 — forked from joshuacerbito/useScroll.js
Custom React hook for listening to scroll events
/**
* useScroll React custom hook
* Usage:
* const { scrollX, scrollY, scrollDirection } = useScroll();
*/
import { useState, useEffect } from "react";
export function useScroll() {
const [lastScrollTop, setLastScrollTop] = useState(0);
@LishuGupta652
LishuGupta652 / useLocalStorage.js
Created April 16, 2020 20:26 — forked from joshuacerbito/useLocalStorage.js
Custom React Hook for handling local storage
import { useState } from 'react';
export default function useLocalStorage(key, initialValue) {
const [item, setInnerValue] = useState(() => {
try {
return window.localStorage.getItem(key)
? JSON.parse(window.localStorage.getItem(key))
: initialValue;
} catch (error) {
return initialValue;
@LishuGupta652
LishuGupta652 / webdev_online_resources.md
Created June 6, 2019 06:49 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)