Skip to content

is it possible to make <a> links ? #7

@Raffiskender

Description

@Raffiskender

Hi!

Your project looks really great. I'm trying to integrate it into my data project, but I ran into an issue yesterday that I couldn't solve.

Is it possible to generate links that call the router's redirect method?

I tried everything but couldn't find a clean solution. The only working approach seems to be using Streamlit buttons. Otherwise, code like this:

<nav>
    <ul>
        <li>
            <a href={st.session_state['router'].redirect(login)}" class="navitem">Login</a>
        </li>
    </ul>
<nav>

causes the link to be executed automatically, making the app rerun infinitely...
As a result, when accessing the homepage, I'm automatically redirected to the login page.

(By the way, I stored the router object in session_state. Is that a good approach?)

I tried:

- Adding JavaScript with event.preventDefault() to prevent the page from reloading

- Replacing the <a> link with a button and handling the click event with JavaScript

- Many, many other things...

So, I'm open to any ideas that could shed some light on this issue.

If there's no way to achieve this, could you explain how navigation is supposed to be handled?

Thank you so much!

Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions