This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eEo pipefail | |
shopt -s inherit_errexit >/dev/null 2>&1 || true | |
if [[ ! "$#" -eq 2 || "$1" != --bucket ]]; then | |
echo -e "USAGE: $(basename "$0") --bucket <bucket>" | |
exit 2 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useMemo } from "react"; | |
import useSubscription from "./useSubscription"; | |
// In this example, "source" is an event dispatcher (e.g. an HTMLInputElement) | |
// but it could be anything that emits an event and has a readable current value. | |
function Example({ source }) { | |
// In order to avoid removing and re-adding subscriptions each time this hook is called, | |
// the parameters passed to this hook should be memoized. | |
const subscription = useMemo( | |
() => ({ |