i would like to use unstable_cache here but i am getting error above.
My ideia is caching my data that is coming from firesotre.
can someone build a code that unstable_cache works with firestore
const [rules, setRules] = useState<RulesProps[]>([])
const [loading, setLoading] = useState(false)
useEffect(() => {
setLoading(true)
const unsubscribe = onSnapshot(
collection(db, ‘users’, userId, ‘rules’),
(snapshot) => {
const rulesData: RulesProps[] = []
snapshot.forEach((doc) => {
rulesData.push(doc.data() as RulesProps)
})
setRules(rulesData)
setLoading(false)
},
)
return () => {
unsubscribe()
}
}, [])
Please i need helping asap
Lucas Carvalho is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.