Skip to content

Instantly share code, notes, and snippets.

View ngochangjelly's full-sized avatar

JellyTran ngochangjelly

View GitHub Profile
@mehiel
mehiel / CountriesDropdown.js
Last active October 20, 2020 12:02
React: use-dropdown hook
import React, { useRef } from "react";
import useDropdown from "use-dropdown";
function CountriesDropdown(props) {
const coutriesEl = useRef(null);
const countriesDropEl = useRef(null);
const [countriesDropOpen, toggleCountriesDrop] = useDropdown(countriesDropEl, coutriesEl);
const onClick = () => toggleCountriesDrop();
return (