How to reset some state vars (or all of them) #1985
Replies: 1 comment 2 replies
-
|
From an event handler, like on_load class State(rx.State):
@rx.event
def on_load(self):
self.reset()
app = rx.App()
app.add_page(lambda: rx.text("hello world"), on_load=State.on_load) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
We would like to reset some state vars (or all of them) when the current page is closed, or alternatively, before the page is loaded.
What's the recommended approach to do that?
If we update some state vars upon the on_load event, would we see the old state first and then the updated one?
Beta Was this translation helpful? Give feedback.
All reactions