0
const onPropsChangeTracker = (props, onData) => {
    console.log("**container called**");
    const subscription = Meteor.subscribe('products.list');
    if(subscription.ready()) {
      const productIds = Products.find().fetch().map(product => product._id);
      onData(null, { productIds });
    }
};

const ProductListContainer = composeWithTracker(onPropsChangeTracker)(ProductList);
export default ProductListContainer;

这是我的 react komposer 的代码。它会自动调用多次。我在其他组件中使用过 react komposer,但它只调用一次,但我仍然想知道为什么这个在我只使用一次时多次调用自己。请帮帮我。

props 没有变化,每次调用它都会收到空对象

4

0 回答 0