user1177440
user1177440

Reputation:

React Flux (alt.js) - not passing data from multiple stores

I appear to be having difficulty comprehending the documentation on handling multiple stores. This is in my APP component ...

  static getStores() {
    return [InventoryStore, CompanyInfoStore];
  }

   static getPropsFromStores() {
     return {
       ...InventoryStore.getState(),
       ...CompanyInfoStore.getState()
     };
   }

  componentDidMount() {
    const clientId = this.state.clientId;
    InventoryActions.getAll(clientId);
    CompanyInfoActions.getAll(clientId);
  }

InventoryActions is not being 'hit' and the only items in my props.items are company info.

Anyone know how to correct this?

Many Thanks!

Upvotes: 0

Views: 111

Answers (1)

Michael Czolko
Michael Czolko

Reputation: 2838

I had the same issue. Maybe it will help you the solution that I made. I'm not joining properties from stores, I'm using separate for each one of them.

   static getPropsFromStores() {
     return {
       inventory: InventoryStore.getState(),
       company: CompanyInfoStore.getState()
     };
   }

Hope it will help you.

Upvotes: 0

Related Questions