sveltesapper

Got to url on:click Sapper


I want to link a button to a relative path in Sapper. Is there a better way than this?

<button onclick="window.location='signup';">Sign Up</button>

Solution

  • If the purpose of this button is to only redirect the user to another page please directly use an anchor and style it as a button:

    <a class="btn" href="/signup">Sign Up</a>
    

    It will make your app more SEO friendly.