English 中文(简体)
• 如何把火葬的多份文件排在“反应”一页?
原标题:How to fetch multiple documents from Firestore in one React page?

目前,我正在使用<条码>重射阵列,与我的消防基地相连接。 在一页中,我需要用户数据和公司数据,这些数据和数据载于<代码>用户和<编码>。 我在使用<代码>useAuthState,首先使用我的用户,然后,如果发言要核实用户是否在场,我就不得不将我的手脚hoo放在前面。

const [user] = useAuthState(auth);

let userValue: DocumentData | undefined,
    userLoading: boolean | undefined,
    userError: FirebaseError | undefined,
    userSnapshot: DocumentSnapshot<DocumentData> | undefined;

let companyValue: DocumentData | undefined,
    companyLoading: boolean | undefined,
    companyError: FirebaseError | undefined,
    companySnapshot: DocumentSnapshot<DocumentData> | undefined;

if (user) {
    [userValue, userLoading, userError, userSnapshot] = useDocumentData(
        doc(db, "users", user.uid),
        {
            snapshotListenOptions: {
                includeMetadataChanges: true,
            },
        };
    );

    [companyValue, companyLoading, companyError, companySnapshot] = useDocumentData(
        doc(db, "companies", userValue.companyId));
    );
}

如果我这样做的话,可以不界定“密码”的字典。 但是,如果我把公司电话放在一份不明确的陈述中,if(用户Value),那么我就会发现这一错误:

反应发现,人类发展指数所呼吁的Hooks的顺序发生了变化。

我如何能够更容易从消防基地收集多份文件?

问题回答

暂无回答




相关问题
How to use one react app into another react app?

I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...

how to get selected value in Ant Design

I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...

How to add a <br> tag in reactjs between two strings?

I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...

热门标签