Skip to the content

Hata旗

Load a native country or region flag, choose supported framing and keep each drawing’s source, author and licence.

Hata (旗) is Japanese for a flag. About the name

Contents

Reference · /bind

preloadFlagsfunction

Load flags before a render that cannot wait: a server render to a string, a static build, the first render on the client that must match it. After it, cachedFlag and the bindings' components give the flag at once.

Import it

import { preloadFlags } from "@johnmorrisdotca/hata/bind";

Also exported from: @johnmorrisdotca/hata/react, @johnmorrisdotca/hata/vue, @johnmorrisdotca/hata/react-native

Definition

function preloadFlags(list: readonly FlagProps[]): Promise<void>

Parameters

NameTypeDescription
listreadonly FlagProps[]

The flags to load.

Returns

Promise<void>

A promise that settles when every flag is loaded (a flag that has none is loaded as null).

Examples

import { cachedFlag, preloadFlags } from "@johnmorrisdotca/hata/bind";

await preloadFlags([{ code: "JP" }, { code: "CA", shape: "round" }]);
console.log(cachedFlag({ code: "JP" })?.name); // "Japan"
Japan

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/hata 1.31.0.