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

Replace reactpy.event decorator with event callbacks #1143

Open
Archmonger opened this issue Sep 21, 2023 · 0 comments
Open

Replace reactpy.event decorator with event callbacks #1143

Archmonger opened this issue Sep 21, 2023 · 0 comments
Labels
priority-3-low May be resolved one any timeline. type-revision About a change in functionality or behavior

Comments

@Archmonger
Copy link
Contributor

Archmonger commented Sep 21, 2023

Current Situation

Currently we utilize a decorator to allow for prevent_default and stop_propogation. But this syntax is pretty awkward.

@component
def LoginForm(props):

    @reactpy.event(prevent_default=True, stop_propogation=True)
    def handle_login(event):
        ...

Proposed Actions

Add callbacks to the event object which perform the same function, removing the need for a decorator.

@component
def LoginForm(props):

    def handle_login(event):
        event.prevent_default()
        event.stop_propogation()
        event.set_focus(True)

It might also make sense to convert our event object from dict to object using Munch, as the dot interface feels a bit more JavaScripty.

@Archmonger Archmonger added flag-triage Not prioritized. priority-3-low May be resolved one any timeline. type-revision About a change in functionality or behavior and removed flag-triage Not prioritized. labels Sep 21, 2023
@rmorshea rmorshea reopened this Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-3-low May be resolved one any timeline. type-revision About a change in functionality or behavior
Projects
None yet
Development

No branches or pull requests

2 participants