mint icon indicating copy to clipboard operation
mint copied to clipboard

Allow property passthrough

Open watzon opened this issue 2 years ago • 0 comments

Feel free to retitle this if you can think of something more descriptive. Essentially it would be nice to be able to pass through properties from a parent component to a child component without having to individually pass through each one. For instance:

component Bar {
  property baz : String
  
  fun render : Html {
    <div>{ baz }</div>
  }
}

component Foo {
  fun render : Html {
    <Bar {...properties} />
  }
}

Granted this a terrible example and not showing a real world use case, but I think the {...properties} way would be one way to handle it. For a real world use case you can check out my mint-tabler library which includes 3100+ generated components which follow a common template and need to pass properties into a child component.

I would agree that this is normally an anti-pattern and can definitely be relied on the wrong way, but in certain situations (like mine), it could very well make the library considerably smaller.

watzon avatar Jan 04 '23 06:01 watzon