#Best way to conditionally disable nextjs Link?

2 messages · Page 1 of 1 (latest)

cursive oak
#

Hello, im mapping over a list here and render my component inside <Link>. I want to disable the link conditionally depending on a boolean value from my category object.

 results.map((category) => {
    return (
       <li key={category.name}>
        <Link href={...}>
         <a>
           <CategoryItem />
              </a>
         </Link>
         </li>
         );
   }

is there a way to do this on the <Link> or am I looking at this from the wrong angle?

ty in advance

woeful hazel
#

Do you want the element to not be a link or to just disable prefetching?