Using the useRaydius Hook

Once you've wrapped your app with the RaydiusProvider , you can now use the Raydius SDK throughout your components and pages via the useRaydius hook!

Example:

import React from 'react'
import { useRaydius } from '@raydius/react'

export default function Home() {
  const {
    login,
    authenticated,
    userAccount,
    logout,
    linkWallet,
    unlinkWallet,
    linkGoogle,
    unlinkGoogle,
  } = useRaydius()

  const { wallets, socials } = userAccount

  if (!authenticated) {
    return (
      <button onClick={login}>login</button>
    )
  }

  return (
    <div>
      <button onClick={logout}>logout</button>
      <button onClick={linkWallet}>linkWallet</button>
      <button onClick={linkGoogle}>linkGoogle</button>
    </div>
  )
}

Last updated