Next.js Discord

Discord Forum

i have small question regarding how nextjs work.

Unanswered
Nile Crocodile posted this in #help-forum
Open in Discord
Nile CrocodileOP
i have a server component


const products=()=>{
 const produtList = await getProducts();
`      return (<>productList.map(v)=>(<Link to="/{v.productName}">     <productCard/>
</Link>)
)</>)
}
const getProducts=async()=>{
    try{
 const products = collection(db, 'products');
  return products
}catch(err){
  return err
}
      
}

}

with above if there user click on any of product from the list here with be redirect to more details above each product page .


once the user click on back button ,he will be redirect back to individual products page.


here i have 2 question,
with the above action , with the products be refetch from the DB?
do i need to change call to fetch instead of try,catch?

0 Replies