Skip to content

Instantly share code, notes, and snippets.

View Aulos's full-sized avatar

Pawel Zubrycki Aulos

  • Growbots
  • Warsaw, Poland
View GitHub Profile
import { useState, useEffect, useRef } from 'react';
// Usage
function App() {
// Create a ref that we add to the element for which we want to detect outside clicks
// State for our modal
const [isModalOpen, setModalOpen] = useState(false);
// Call hook passing in the ref and a function to call on outside click
const ref = useOnClickOutside(() => setModalOpen(false));

Keybase proof

I hereby claim:

  • I am aulos on github.
  • I am pawzubr (https://keybase.io/pawzubr) on keybase.
  • I have a public key ASBJcu9cbnM6sdGQfpUnyU9k9i6Oi0jFp_jozvRYQ8n5fwo

To claim this, I am signing this object:

@Aulos
Aulos / controller.js
Last active August 29, 2015 13:56 — forked from mkosler/controller.js
$(function () {
$("#controls > div").hide();
$('<canvas id="viewport" width="140" height="65">')
.css("float", "left")
.appendTo("#controls");
$("<button />", {
text: "Show",
$(function () {
$("#controls > div").hide();
$('<canvas id="viewport" width="140" height="65">')
.css("float", "left")
.appendTo("#controls");
$("<button />", {
text: "Show",