Skip to content
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

[ENG-3749] type safe vars #4066

Merged
merged 2 commits into from
Oct 7, 2024
Merged

[ENG-3749] type safe vars #4066

merged 2 commits into from
Oct 7, 2024

Conversation

adhami3310
Copy link
Member

@adhami3310 adhami3310 commented Oct 5, 2024

import reflex as rx

app = rx.App()


class State(rx.State):
    x: rx.Field[bool] = rx.field(False)

    def flip(self):
        self.x = not self.x


@app.add_page
def index():
    return rx.vstack(
        rx.button("Click me", on_click=State.flip),
        rx.text(State.x),
        rx.text(~State.x),
    )

Copy link

linear bot commented Oct 5, 2024

masenf
masenf previously approved these changes Oct 5, 2024
Copy link
Collaborator

@masenf masenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool 🤯

@masenf masenf merged commit 8663d4f into main Oct 7, 2024
39 checks passed
@masenf masenf deleted the type-safe-var branch October 7, 2024 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pylance shows error when using not operator ~
2 participants