useTryYourSize()
The TryYourSize client, or null until it has loaded.
function useTryYourSize(): TryYourSizeClient | nullReturns
Section titled “Returns”TryYourSizeClient | null: The client, or null until it has loaded. Throws outside a provider.
Example
Section titled “Example”function SizeBadge({ sku }: { sku: string }) { const tys = useTryYourSize(); const [size, setSize] = useState<string | null>(null); useEffect(() => { tys?.recommendation(sku).then((r) => setSize(r.status === "ready" ? r.size : null)); }, [tys, sku]); return size ? <span>Your size: {size}</span> : null;}Was this page helpful?
Thank you. We read every answer.