/auth
Search
K
Comment on page

mountSignIn

This function renders the SignIn component inside of the provided Div and allows for customization of the component.

Usage

import React, { useEffect, useRef } from 'react';
import { useSlashAuth } from '@slashauth/slashauth-react';
export const MountSignIn = () => {
const loginDiv = useRef<HTMLDivElement>(null);
const { mountSignIn } = useSlashAuth();
useEffect(() => {
if (loginDiv.current) {
mountSignIn(loginDiv.current, {});
}
}, []);
return <div ref={loginDiv}></div>;
};

Return Value

void

Configuration

node

Pass in the div that we should mount the signIn to.
import React, { useEffect, useRef } from 'react';
import { useSlashAuth } from '@slashauth/slashauth-react';
export const MountSignIn = () => {
const loginDiv = useRef<HTMLDivElement>(null);
const { mountSignIn } = useSlashAuth();
useEffect(() => {
if (loginDiv.current) {
mountSignIn(loginDiv.current, {});
}
}, []);
return <div ref={loginDiv}></div>;
};

walletConnectOnly (optional)

Set to true to only connect the wallet and not initiate the signIn flow.
import React, { useEffect, useRef } from 'react';
import { useSlashAuth } from '@slashauth/slashauth-react';
export const MountSignIn = () => {
const loginDiv = useRef<HTMLDivElement>(null);
const { mountSignIn } = useSlashAuth();
useEffect(() => {
if (loginDiv.current) {
mountSignIn(loginDiv.current, { walletConnectOnly: true });
}
}, []);
return <div ref={loginDiv}></div>;
};