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, { useState, useCallback } from "react"; | |
import { useBlurhash } from "./use-blurhash"; | |
import { useInView } from "react-intersection-observer"; | |
type Props = React.DetailedHTMLProps< | |
React.ImgHTMLAttributes<HTMLImageElement>, | |
HTMLImageElement | |
> & { blurhash?: string | null }; | |
// Uses browser-native `loading="lazy"` to lazy load images |
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
const greeters = { | |
'en': 'english', | |
'fr': 'french' | |
}; | |
const promise = (async () => { | |
const greeter = greeters[navigator.language.split('-')[0]]; | |
if (!greeter) { | |
throw new Error('No greeter for you!'); |