Search code examples
reactjsfluxalt.js

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!


Solution

  • 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.