#How to query a collection in a client component for dynamic rendering (pagination)?

2 messages · Page 1 of 1 (latest)

copper nova
#

Hey,

I'm trying to dynamically fetch data to render a list of events based on pagination and a time filter.

I am using useState.

`"use client"

...

useEffect(() => {
    const fetchData = async () => {
        const eventReq = await fetchEventsByDateAndTag(filter, selectedPage, typeof tag === "string" ? tag : undefined)
        setEventData(eventReq || {})
    }
    fetchData()
}, [filter, selectedPage])`

Getting this error, and only get it when trying to do async stuff in a client component:

Error: × You're importing a component that needs "revalidateTag". That only works in a Server Component which is not supported in the pages/ directory. Read more: https://nextjs.org/docs/app/building-

It feels like am missing something. Would love if anyone of ypu could enlighten me.

Thanks 🙂