Liam Idrovo
Liam Idrovo
TTCTheo's Typesafe Cult
Created by python8u on 4/12/2024 in #questions
I want to get information from the indexedDB and include this in the first render, without delay
If I'm understanding correctly, you want to access IndexedDB server side because you want to include data from it in the html served to the client? All components in Nextjs have their first render on the server. Client components render once on the server and once more when they're on the client and hydrate the DOM. Server components once and only once before they're sent to the client. So you can't really have access to the contents to IndexedDB on first render because it always happens on the server and IndexedDB is obviously a browser API @python8u
5 replies
TTCTheo's Typesafe Cult
Created by Domcario on 4/27/2023 in #questions
how to use indexeddb with react query (dexie.js)
You can use React Query for any sort of asynchronous calls.
const fetcher = async () => {
// code that communicates with db
}

const query = useQuery({
queryKey: ['blabla],
queryFn: fetcher
})
const fetcher = async () => {
// code that communicates with db
}

const query = useQuery({
queryKey: ['blabla],
queryFn: fetcher
})
Does this answer your question?
2 replies