Skip to content

Instantly share code, notes, and snippets.

View shkumbin's full-sized avatar
🏠
Working from home

Shkumbin Maksuti shkumbin

🏠
Working from home
View GitHub Profile
import React, { useState, useEffect } from "react";
import ReactDOM from "react-dom";
import makeHookCompat from "./src";
// make a hook as usual
function useMedia(query) {
let [matches, setMatches] = useState(window.matchMedia(query).matches);
useEffect(() => {
let media = window.matchMedia(query);