LogoLogo
CSPR.build PortalCSPR.click Website
CSPR.click v1.3
CSPR.click v1.3
  • Introduction
    • CSPR.click overview
    • Get your application Id
    • Changelog
  • UI SDK
    • Getting started with the template application
    • Integrating the UI SDK into your application
    • Integrating the UI SDK into a non-React application
    • Customizing the top bar
      • Account dropdown menu
      • Theme selector
      • Network selector
      • Language selector
      • Currency selector
      • Custom selector
    • useClickRef() hook
    • Handling events
    • Signing transactions
  • Core JS SDK
    • Getting started
    • Properties
    • Methods
    • Types
    • Events
  • Get support
    • Contact us
Powered by GitBook
On this page
  1. UI SDK

useClickRef() hook

PreviousCustom selectorNextHandling events

Last updated 11 months ago

In your components, you'll often need to call the CSPR.click API to get data or request an operation. To get a reference to the CSPR.click SDK instance make use of the useClickRef() React hook:

import { useClickRef } from '@make-software/csprclick-react';

function MyComponent() {
  const clickRef = useClickRef();
  ...
}

Then, in your application you'll be able to request CSPR.click to perform some operations using the class , or get values reading the class .

Common methods

One of the benefits of using the UI SDK is that it provides the UI and the logic to handle common situations like showing the sign-in options, interacting with the wallets, switching from one account to another, and many more. Therefore, you'll often be using a reduced set of CSPR.click methods in your application. Let's review the most common ones:

  • signIn(). Shows the connection options to start a user's session.

  • signOut(). Closes your user's session.

  • getActiveAccount(). Returns the active account data.

  • getActivePublicKey(). Returns the connected public key.

  • switchAccount(). Displays to the user a modal dialog to switch to another account when the user session is open.

  • sign(). Triggers the process to request the user the signature of a transaction.

  • send(). Similar to sign(), but when the transaction is signed, sends it to a Casper node for its processing.

  • signMessage(). Triggers the process to request the user the signature of a message.

methods
properties