Skip to main content
Version: 1.0.0

GiftRedeemContainer

Handles starting the flow of redeeming a gift code. once the user submits a gift code successfully, the code is stored in usePelcro's giftCode field.

Usage#

import React from "react";
import {
GiftRedeemContainer,
GiftRedeemCode,
GiftRedeemSubmitButton,
Alert,
} from "@pelcro/react-pelcro-js";
import "@pelcro/react-pelcro-js/dist/pelcro.css";
export const CustomGiftRedeemView = () => {
return (
<GiftRedeemContainer
onSuccess={(giftCode) => {
console.log(giftCode);
}}
onFailure={() => {
console.error("error");
}}
>
<Alert />
<GiftRedeemCode label="Gift code" />
<GiftRedeemSubmitButton />
</GiftRedeemContainer>
);
};

Reference#

GiftRedeemContainer#

Props#

onSuccess#

(giftCode) โ‡’ void

Callback function called when the gift code is submitted succesfully.

onFailure#

() โ‡’ void

Callback function called when submitting the gift code fails.

Children components#

Alert#

Displays the relevant errors or success messages.


GiftRedeemCode Required#

Instance of Input

Input field component for the gift code.


GiftRedeemSubmitButton Required#

Instance of Button

A button component that submits the form.

Props#

name#

string?

The title displayed inside the button