0

I've been using / testing the new Shoutem builder, and I've installed both the products and the favourites extensions but am wondering on how I can "link" the two in between. So a user can favourite a specific product and store it in a little dropdown menu. I've searched the documentation and sample apps and I haven't seen the both used in action. Actually I haven't seen the Favourites extension used. Can this be easily accomplished by linking the two extensions?

I am looking for a starting point. So if anyone can guide or link me in the right direction that would be interesting.

Thanks.

Robert
  • 23
  • 3

2 Answers2

1

This is not documented yet, but we have it implemented. You can check Books extension. It does just what you're looking for. It requires some changes on Product extension. You can check here how you can modify existing extension.

dculjak
  • 11
  • 2
0

The app folder of extension is what is bundled inside of the app. That said, everything that extension exposes in its app/index.js is the public API, which can be imported directly inside of the other extension:

import {
  Screen
} from 'tom.restaurants'

...where tom is used as example for developer name and restaurants for example for extension name.

All extension share the global app state, which is divided into extension sub-states prefixed by extension full name:

{
  'tom.restaurnats': {
      // state of 'tom.restaurants' extension
  }
}

This way, you can make the 2 extension communicate.

I would recommend you checking out these 2 guides:

Tommz
  • 3,393
  • 7
  • 32
  • 44