You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We could introduce @xt.method decorator in Nextpy for defining event handlers within state classes. This feature is intended to enhance code readability, standardize the declaration of methods handling state changes, and align with AI code generation practices.
Current Behavior
Currently, Nextpy requires methods within state classes to be defined directly, without specific decorators. This approach is functional but does not distinguish between regular methods and event handlers explicitly designed to modify the state.
Proposed Behavior
The introduction of the @xt.method decorator would allow developers to clearly mark methods in the state class as event handlers. This not only improves code readability but also aligns with AI code generation patterns, where such decorators are often included by default. It could also facilitate additional framework optimizations or checks.
We could introduce
@xt.method
decorator in Nextpy for defining event handlers within state classes. This feature is intended to enhance code readability, standardize the declaration of methods handling state changes, and align with AI code generation practices.Current Behavior
Currently, Nextpy requires methods within state classes to be defined directly, without specific decorators. This approach is functional but does not distinguish between regular methods and event handlers explicitly designed to modify the state.
Proposed Behavior
The introduction of the
@xt.method
decorator would allow developers to clearly mark methods in the state class as event handlers. This not only improves code readability but also aligns with AI code generation patterns, where such decorators are often included by default. It could also facilitate additional framework optimizations or checks.For example:
Benefits
The text was updated successfully, but these errors were encountered: