Skip to main content
Version: 1.0.0

AddressCreateModal

The address create modal is used to create a new address.

Loading...

Usage#

import React from "react";
import {
AddressCreateModal,
PelcroModalController,
usePelcro,
} from "@pelcro/react-pelcro-js";
import "@pelcro/react-pelcro-js/dist/pelcro.css";
export const AddressCreateExample = () => {
const { switchView } = usePelcro();
return (
<>
<button onClick={() => switchView("address-create")}>
Create an address
</button>
<PelcroModalController>
<AddressCreateModal />
</PelcroModalController>
</>
);
};

Reference#

Props#

onDisplay#

() โ‡’ void

Callback function called when the modal is first displayed.

onClose#

() โ‡’ void

Callback function called when the modal is closed.

onSuccess#

(userObject) โ‡’ void

Callback function called when the address is created succesfully.

onGiftRedemptionSuccess#

(userObject) โ‡’ void

Callback function called when the user is redeeming a gift, and the gift is redeemed succesfully.

onFailure#

(errorObject) โ‡’ void

Callback function called when the address creation / gift redemption fails.

type#

"shipping"|"billing"

Address type, default is "shipping".