我正在尝试使用 reactfire 同步离线数据,但我不断收到此错误:
<块引用>FirebaseError:Firestore 已启动,无法再启用持久性。您只能在对 Firestore 对象调用任何其他方法之前启用持久性。
还有一个关于它的问题 here,文档是 here,但由于我使用的是 nextjs,我没有应用程序,所以另一个问题中的解决方案没有奏效对我来说,把
import { Row, Col } from 'react-bootstrap';
import square from '../../assets/img/square.png';
function PostComponent(infos) {
console.log(infos.infos); //checking the received data
return(
<article className="article-box">
<Row>
<Col xs={3}>
<img className="article-img" src={square} alt="imagem" />
</Col>
<Col xs={7} className="inside-text" >
<h3>{infos.infos.name}</h3>
{<span dangerouslySetInnerHTML={{__html:[infos.infos.descrip]}}></span>}
<br/>
<Row>
<Col xs={10}>
<button>Ler Mais</button>
</Col>
<Col xs={1} className="date-post">
<small>{infos.infos.date}</small>
</Col>
</Row>
</Col>
</Row>
</article>
)
}
export default PostComponent;
我的应用程序中的任何地方都给我一个类型错误,我不知道如何解决;
preloadFirestore({
setup: firestore => firestore().enablePersistence()
});
我也看到使用了 this,但这会带来多种类型错误,我不确定应该把它放在哪里。这是代码
Argument of type '{ setup: (firestore: () => Firestore) => Promise<void>; }' is not assignable to parameter of type 'PreloadOptions<() => Firestore>'.
Property 'firebaseApp' is missing in type '{ setup: (firestore: () => Firestore) => Promise<void>; }' but required in type 'PreloadOptions<() => Firestore>'.
如果您有任何我可以从这里走的方向,我将不胜感激。