cachedFlagfunction
The flag, if it is already loaded: what a component draws at once, on a server or in a static build, with no waiting.
Import it
import { cachedFlag } from "@johnmorrisdotca/hata/bind";
Definition
function cachedFlag(props: FlagProps): BoundFlag | null | undefined
Parameters
| Name | Type | Description |
|---|---|---|
props | FlagProps | The flag, as the element's attributes give it. |
Returns
BoundFlag | null | undefined
The flag; null where it was loaded and there is none; undefined where it is not loaded yet (call resolveFlag or preloadFlags).
Examples
import { cachedFlag, preloadFlags } from "@johnmorrisdotca/hata/bind";
console.log(cachedFlag({ code: "FR" })); // undefined: not loaded yet
await preloadFlags([{ code: "FR" }]);
console.log(cachedFlag({ code: "FR" })?.aspect); // 1.5undefined
1.5What it prints (run when this page was built)