Skip to content

more isolated/stateful components #5

@leeoniya

Description

@leeoniya

split from #4

IMO, there are a couple issues with components.

  1. render is called as both a pseudo-constructor to inject params into the component's closure as well as a refresh re-renderer.

  2. Components are not instanced, so no reference to them exists, this prevents exposure of any public api. eg not possible:

    return {
       render: render,
       someAPIMethod: foo,
       somePublicProp: bar,
    }
    
  3. Pre-instantiated components cannot be provided into a tree.

  4. The top-level .update() method acts as a constructor for the entire component tree and must accept params for all its sub-components.

For 1, maybe expose a render: and separate init:.
For 2, creating instances will allow for an API to be exposed for each component.
For 3, components can be externally created using their own inits and inserted into their parents via the parent's init (dep injection).
For 4, should be a non-issue if the others are implemented.

I don't know how much of this is do-able and would bloat/complicate the framework, so consider these wishes :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions