Skip to content

Instantly share code, notes, and snippets.

View jz222's full-sized avatar
🦅

Timo Zimmermann jz222

🦅
View GitHub Profile
@jz222
jz222 / getFlag.js
Created April 14, 2021 12:24
A function that returns the flag emoji for a given country code.
const getFlag = (countryCode) => String.fromCodePoint(...[...countryCode.toUpperCase()].map(x => 0x1f1a5 + x.charCodeAt()));
@jz222
jz222 / useDialog.js
Created October 13, 2019 16:17
A custom hook for dialogs in React
import React, { useCallback, useEffect, useRef, useState } from 'react';
import Button from 'components/UI/button/button';
import styling from './useDialog.module.scss';
export default (cb) => {
const [{ open, params }, setDialogMeta] = useState({ open: false });
const containerRef = useRef(null);