Reputation: 891
Instead of injecting a store at the top level of the app using Provider, is there a way to use a store class locally at the component level?
For example -- I have a class/store which is used to build an HTML table. But each table is different, which is why I don't want to inject it at the top level. I want each page that has an HTML table to have it's own store instance, and feed it the properties. That way I can run ajax queries and insert the result into the store.
Is this possible?
Upvotes: 1
Views: 1061
Reputation: 891
One way is to export the class definition and simply import it into the component which will use it and then create a new instance. As long as the component which uses it is wrapped in an observer it works just fine.
Upvotes: 2