def _add_event_handler(
        cls,
        name: str,
        fn: Callable,
    ):
        """Add an event handler dynamically to the state.

        Args:
            name: The name of the event handler.
            fn: The function to call when the event is triggered.
        """
        handler = cls._create_event_handler(fn)
        cls.event_handlers[name] = handler
        setattr(cls, name, handler)
Add an event handler dynamically to the state.

        Args:
            name: The name of the event handler.
            fn: The function to call when the event is triggered.
        
reflex/state.py