Skip to content

How to use multiple hooks that depend on each other? #44

@its-danny

Description

@its-danny

Example:

const [authUser, authLoading, authError] = useAuthState(firebase.auth());
const [user, userLoading, userError] = useDocument(firebase.firestore().doc(`users/${authUser.uid}`));

I can't put useDocument in a if (authUser) because React breaks with: Rendered more hooks than during the previous render.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions