Next.js Discord

Discord Forum

I would like to add a link, but I don't know how to do it.

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
How do I add a link to each of the following codes?
<List>
  {['hoge', 'hogehoge', 'piyo', 'piyopiyo'].map((text, index) => (
    <ListItem key={text} disablePadding>
      <ListItemButton>
        <ListItemText primary={text} />
      </ListItemButton>
    </ListItem>
   ))}
</List>

4 Replies

I have no idea what these elements are supposed to be, but why not just use a Link element instead of ListItemButton?
You could technically wrap the button with a Link.
Yellow croaker
https://nextjs.org/docs/app/api-reference/components/link

Here is document for Link.

You should include a bit More info to your code, like supremedeity Said, its hard to know what your elements are doing
Transvaal lionOP
Thank you!!!