⚙️
Comet SDK Docs
  • Welcome to the Comet SDK!
  • Getting Started
  • Project Guides
    • Launch and mint your first NFT collection
  • Reference
    • Comet SDK Reference
      • Comet REST API
        • Collections
        • Airdrops
        • Gallery
        • Usage
      • Comet React SDK
        • Getting started
        • Components
        • Hooks
          • useAccount
          • useMint
          • useSignMessage
          • useSignTransaction
          • useGetSharedSecret
Powered by GitBook
On this page
  • API
  • Example
  1. Reference
  2. Comet SDK Reference
  3. Comet React SDK
  4. Hooks

useMint

Start the process of minting a token.

PrevioususeAccountNextuseSignMessage

Last updated 2 years ago

If you want a custom minting experience without using the pre-existing MintButton component, you can also initiate the mint process for a customer with the useMint hook. This hook will open a payment modal (if necessary) and start minting a token to the user.

API

const { startMint } = useMint({ collectionId: "<COLLECTION ID>" });

Much like the , you can supply collectionId to the useMint hook. If the user is not logged in, login will first be prompted.

Example

import { useMint } from '@comet-labs/react';

function App() {
  const { startMint } = useMint({ collectionId: 'ac37722abd3b' });

  return (
    <div className="App">
      <button onClick={startMint}>
        Custom mint button
      </button>
    </div>
  );
}
MintButton component