使用 ReactFire 和 Express.js 加载数据时如何更新?

问题描述

使用 ReactFire 教程中的代码

import React,{ Component,Suspense } from 'react';
import { render } from 'react-dom';

import 'firebase/database';
import { FirebaseAppProvider,useFirestoreDocData,useFirestore,SuspenseWithPerf } from 'reactfire';

const firebaseConfig = {
    //config here
};

async function Burrito() {
  // easily access the Firestore library
  const burritoRef = useFirestore()
    .collection('tryreactfire')
    .doc('burrito');

  // subscribe to a document for realtime updates. just one line!
  const {status,data} = useFirestoreDocData(burritoRef);

  // easily check the loading status
  if (status === 'loading') {
    return <p>Fetching burrito flavor...</p>
  }

  return <p>The burrito is {data.yummy ? 'good' : 'bad'}!</p>;
}

function App() {
  return (
    <FirebaseAppProvider firebaseConfig={firebaseConfig}>
      <h1>?</h1>
      <Burrito />
    </FirebaseAppProvider>
  );
}

module.exports = App;

我被困在“获取墨西哥卷饼的味道......”。在快速应用程序中提供此服务。我应该怎么做才能在加载数据时更新它?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)