Skip to content

Replace reactpy.event with dot notation callbacks #1143

Closed

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):
        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.

Activity

  1. added
    priority-3-lowMay be resolved one any timeline.
    type-revisionAbout a change in functionality or behavior
    and removed on Sep 21, 2023
  2. changed the title [-]Replace `reactpy.event` decorator with event callbacks[/-] [+]Replace `reactpy.event` with dot notation event callbacks[/+] on Apr 5, 2025
  3. changed the title [-]Replace `reactpy.event` with dot notation event callbacks[/-] [+]Replace `reactpy.event` with dot notation callbacks[/+] on Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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