Maybe
A value that may be absent at runtime.
A value that may be absent at runtime. null and undefined remove the attribute or property.
Import#
ts
import type { Maybe } from "@shadow-js/web";
Signature#
ts
type Maybe<T> = T | null | undefined
Examples#
ts
import type { Maybe } from "@shadow-js/web";
function linkTarget(external: boolean): Maybe<string> {
return external ? "_blank" : undefined; // undefined: no target attribute
}
const link = <a href="/docs" target={linkTarget(true)}>Docs</a>;