I am trying to return the categories in nextjs component which I have stored in the database. I am using map function to return but it is not working.
const showAllCategories = () =>{
return categories.map((c,i)=>{
<Link key={i} href ={`/categories}`} >
<a className="btn btn-outline-primary mr-1 ml-1 mt-3"> {c.name }</a>
</Link>
})
}
Im trying to return the categories name inside the section tag of html
<section>
{/* <p>Show categories and tags</p> */}
<div className="pb-5">
{JSON.stringify(showAllCategories())}
{showAllCategories()}
{showAllTags()}
</div>
</section>
I tried debugging using JSON.stringyfy but it shows
[null,null,null,null,null,null,null,null]