-
-
Notifications
You must be signed in to change notification settings - Fork 323
Style Cannot Be Updated #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Probably the cause of the broken snake game example: #451 |
This fixes it: import idom
import random
@idom.component
def Test():
color_toggle, set_color_toggle = idom.hooks.use_state(False)
color = "red" if color_toggle else "blue"
return idom.html.div(
idom.html.button(
{
"onClick": lambda event: set_color_toggle(not color_toggle),
"style": {"backgroundColor": color, "color": "white"},
},
"toggle",
key=str(random.random()),
),
)
idom.run(Test, port=5000) There's something wrong with keys... |
Turns out its because we started modifying the view model inplace using |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When clicking the button in the code below it's background color should change, but it does not:
Originally reported by @jgburford in #478 (reply in thread)
The text was updated successfully, but these errors were encountered: