widgetti / solara

A Pure Python, React-style Framework for Scaling Your Jupyter and Web Apps
https://solara.dev
MIT License
1.62k stars 105 forks source link

feat: query parameter hook #34

Open maartenbreddels opened 1 year ago

maartenbreddels commented 1 year ago

Allows to use query parameters to manage state.

railway-app[bot] commented 1 year ago

This PR is being deployed to Railway 🚅

web: ◻️ REMOVED

maartenbreddels commented 1 year ago

@koenvo this is what I planned for the query parameter API.

But with solara 1.7.1 you can use the more crude API:

    ....
    router = use_router()
    router.push("/some/path?count=10")
koenvo commented 1 year ago

@koenvo this is what I planned for the query parameter API.

But with solara 1.7.1 you can use the more crude API:

    ....
    router = use_router()
    router.push("/some/path?count=10")

Great! For me it’s most important to be able to access the query parameters instead of pushing new ones. Should that already work using use_router().search?

maartenbreddels commented 1 year ago

Great! For me it’s most important to be able to access the query parameters instead of pushing new ones. Should that already work using use_router().search?

Indeed, that should be enough for your use case, so you don't need to wait til this branch is merged and released.