Skip to content

Use composition instead of classes with Layout and LifeCycleHook  #412

Closed
@rmorshea

Description

@rmorshea

This is similar to #324 but specifically focused on the Layout and LifeCycleHook since those will be the most complex to refactor. I'm not really sure what the interface would ultimately look like - whether there would still be a layout with render and dispatch methods, or if those would be functions accepting some sort of LayoutState instead. Maybe a bit like:

with layout_context(component) as layout:
    old_state, new_state = await render(layout)
    diff = compute_diff(old_state, new_state)
    await dispatch_event(layout)

You could take a similar approach to hooks as well, but just applying functions to objects containing state.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions