Skip to content

Instantly share code, notes, and snippets.

View rishadomar's full-sized avatar

Rishad Omar rishadomar

  • Cape Town, South Africa
  • 20:41 (UTC -12:00)
View GitHub Profile
@didacus
didacus / useWindowSize.js
Created January 29, 2021 16:12
React hook to capture window size (Debounced).
import { useState, useEffect } from "react"
// Debounce function
function debounce(func, wait, immediate) {
var timeout
return function () {
var context = this,
args = arguments
var later = function () {
timeout = null