Skip to content

Instantly share code, notes, and snippets.

View ShawnToubeau's full-sized avatar

Shawn Toubeau ShawnToubeau

View GitHub Profile
import { useState, useEffect } from "react";
export enum AttributeType {
CLASSNAME = "className",
ID = "id"
}
function getElementHeight(selector: string, attributeType: AttributeType) {
let element: HTMLElement;
@ShawnToubeau
ShawnToubeau / WindowDimensions.tsx
Last active September 18, 2020 17:34
React Window Size Hook
import { useState, useEffect } from "react";
function getWindowDimensions() {
const { innerWidth: width, innerHeight: height } = window;
return {
width,
height
};
}
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: "stable",