ionic-team / stencil-state-tunnel

A tool for tunneling state/props down through a component stack.
MIT License
94 stars 13 forks source link

Allow consumers to have props #18

Open chrisdmacrae opened 4 years ago

chrisdmacrae commented 4 years ago

Consumers currently can't have props, and they create a new DOM element context-consumer which can cause problems for hierarchy/styling/etc since you can't currently apply classes, data attributes, etc to this component.

I propose this is done by doing the following:

export default createProviderConsumer<State>({
    message: 'Hello!'
  },
  (subscribe, child, props) => (
    <context-consumer subscribe={subscribe} renderer={child} ...props />
  )
);