Ir al contenido

addRecommendationListener()

Esta página aún no está disponible en tu idioma.

Function@tryyoursize/react-native

Calls listener now (once known) and on every change. Returns { remove }.

function addRecommendationListener(product: string, listener: (r: Recommendation) => void): { remove(): void }
productstringObligatorio

Your product ID or SKU.

listener(r: Recommendation) => voidObligatorio

Called now (once known) and on every change.

{ remove(): void }: { remove() }.

useEffect(() => {
const sub = addRecommendationListener("SKU-123", (rec) => {
if (rec.status === "ready" && !touched) setSize(rec.size);
});
return () => sub.remove();
}, []);

¿Te ha resultado útil esta página?