Skip to content

Instantly share code, notes, and snippets.

@leighhalliday
leighhalliday / context.jsx
Created Feb 19, 2020
React Context Rendering Demo
View context.jsx
import React from "react";
const MyContext = React.createContext();
const MyProvider = ({ children }) => {
const [theme, setTheme] = React.useState("light");
const nextTheme = theme === "light" ? "dark" : "light";
const value = {
theme,
@dcollien
dcollien / ImageTools.es6
Last active Jan 17, 2021
Resize Images in the Browser
View ImageTools.es6
let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () {
try {
return Boolean(new Blob());
} catch (e) {
return false;
}
}());
let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () {
try {