Reusable Custom Card Component Action Button Issue #527
-
Beta Was this translation helpful? Give feedback.
Answered by
wwwillchen
Jun 25, 2024
Replies: 1 comment 1 reply
-
Take a look at: https://google.github.io/mesop/guides/interactivity/#avoid-using-closure-variables-in-event-handler Specifically, you should change the code here: def redirect(e):
print(title)
print(path)
if path:
me.navigate(e.key) # use `e.key` and not `path`
me.button(
key=path # Add a key, so you can use it in the redirect
button_text,
on_click=redirect, Unfortunately this isn't really intuitive in Mesop but it's a limitation with how event handlers are registered. Let us know if you're still running into issues. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
wwwillchen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Take a look at: https://google.github.io/mesop/guides/interactivity/#avoid-using-closure-variables-in-event-handler
Specifically, you should change the code here:
Unfortunately this isn't really intuitive in Mesop but it's a limitation with how event handlers are registered. Let us know if you're still running into issues.