This file contains hidden or 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 { Link } from "react-router-dom"; | |
type AllowedElements = 'div' | typeof Link | |
interface PolymorphicComponentProps<T extends React.ElementType> { | |
as?: T extends AllowedElements ? T : never | |
className?: string | |
} | |
function PolymorphicComponent<T extends React.ElementType = 'div'>({ |
This file contains hidden or 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 from 'react'; | |
/** | |
* localStorage works just like useState, except it backs up to (and restores from) localStorage. | |
* | |
* @param initialState The initial value to use | |
* @param key The local storage key to use | |
* @param options Optional. Currently allows a timeout (in milliseconds) to debouce the setting localStorage if needed. | |
* @returns The current value of the local storage item state, and a function to set it | |
*/ |
This file contains hidden or 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 -euo pipefail | |
# Define the expected pattern. | |
EXPECTED_TAG_PATTERN="^v.+\..+$" | |
EXPECTED_TAG_PATTERN_EXAMPLE="v1.2.3" | |
# Check if git is installed | |
if ! command -v git >/dev/null 2>&1; then | |
printf >&2 "git is not installed. Aborting.\n" |