Skip to main content
The useSignUpOrLogIn hook initiates the Para signup or login flow for a given email or phone number. After calling it, use useVerifyNewAccount or useWaitForLogin to complete the flow.

Import

import { useSignUpOrLogIn } from "@getpara/react-native-wallet";

Usage

import { useSignUpOrLogIn } from "@getpara/react-native-wallet";
import { useState } from "react";
import { View, TextInput, Button, Text } from "react-native";

function LoginScreen() {
  const [email, setEmail] = useState("");
  const { signUpOrLogInAsync, isPending } = useSignUpOrLogIn();

  const handleSubmit = async () => {
    try {
      const result = await signUpOrLogInAsync({ auth: { email } });
      // result is AuthStateVerify (new user) or AuthStateLogin (returning user)
    } catch (err) {
      console.error(err);
    }
  };

  return (
    <View>
      <TextInput value={email} onChangeText={setEmail} placeholder="Email" />
      <Button title={isPending ? "Sending..." : "Continue"} onPress={handleSubmit} disabled={isPending} />
    </View>
  );
}