Reusable createContainer


#1

I wanted to reuse my createContainer that just fill out a select Button of my forms into different Component.

Here’s my current code which is very identical. Is there a way to write only once the createContainer and just pass what component to use?

For Component A

export default CostCenterContainerA = createContainer( ( ) => {
    const subsReady = Meteor.subscribe('costCenters');
 
    return {
        centers: CostCenters.find().fetch(),
        loading: !subsReady.ready(),
    }
}, CompA);

For Component B

export default CostCenterContainerB = createContainer( ( ) => {
    const subsReady = Meteor.subscribe('costCenters');
 
    return {
        centers: CostCenters.find().fetch(),
        loading: !subsReady.ready(),
    }
  }, CompB);