Skip to content

Replace reactpy.event with dot notation callbacks #1143

Open
@Archmonger

Description

@Archmonger

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()

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority-3-lowMay be resolved one any timeline.type-revisionAbout a change in functionality or behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions