useMojitoUser

πŸ§‘ Use this hook to get the current user information.

🚧

Authentication required to use this hook

The useMojitoUser hook will call and return a response from the user API.

Hooks Sample Code

...
import useMojitoUser from "mojito-hooks/useMojitoUser";

function App {
    const { user, isLoading } = useMojitoUser();

    if(isLoading) return <Loader />;

    if(user) return (
        <div>
            {user.email}
        </div>
    );

    return <div>No user available</div>
}

Parameters

πŸ“˜

This hook doesn't accept any parameters.

Result

PropertyDescriptionType
userInformation about the current user.User
isLoadingDisplay request loading status, provided for convenience.Boolean
errorThe error object for the query, if an error was thrown.Error
refetchA function to manually refetch the query.(options: T) => Promise<U>
queryResultOriginal React-Query query result.QueryResult<T>