Link vs Button for single-page experience

  • victoruxui-1298094745461067827

    Victor Giron

    7 months ago

    Hey everyone, I'm building a dashboard and I was thinking to use <a> elements for the sidebar menu, to change the path of the page and depending on that, display the content for each section.

    Using <a> renders the whole page and the sidebar menu sometimes flicks for a milisecond.

    When I use <button> this doesn't happen.

    What's the recommended way to do this?
  • lucasg-1298095213700583466

    Lucas G

    7 months ago

    Links (<a> tags with href attributes) are for navigating to a new page, it is reloading the page
  • lucasg-1298095570665345065

    Lucas G

    7 months ago

    If it's an SPA type of setup where the path determines show conditions then it wouldn't be needed or why do you need them to be link tags
    🔥2
  • victoruxui-1298095837280338020

    Victor Giron

    7 months ago

    Thank you Lucas, I'm starting to think that you're an AI hahaha
  • 😂3