• Custom hook to fetch all necessary user data from GitHub

    Combines three separate GraphQL queries:

    • Basic user information (profile, bio, etc.)
    • Contribution statistics
    • Repository data

    Features:

    • Parallel query execution
    • Combined loading states
    • Unified error handling
    • Data aggregation
    • Skip functionality

    Query Management:

    • Handles multiple concurrent queries
    • Combines results automatically
    • Manages loading states
    • Aggregates errors

    Error Handling:

    • Returns first encountered error
    • Maintains type safety
    • Preserves error details

    Performance:

    • Parallel query execution
    • Efficient data combining
    • Proper cache usage

    Parameters

    • username: string

      GitHub username to fetch data for

    • skip: boolean

      Whether to skip the queries

    Returns UserQueryResult

    Combined result object containing user data, loading state, and errors

    const { userData, loading, error } = useUserQueries('octocat', false);

    if (loading) return <Loading />;
    if (error) return <Error error={error} />;
    if (userData) return <UserProfile user={userData} />;