Closed sporto closed 9 years ago
Oh, found this http://martyjs.org/guides/es6/index.html Closing
The link is dead and I have the same problem... What is the solution? (Note I don't use es6)
Back in Marty 0.9 you had to register stores before using them:
class LibrariesStore extends Marty.Store {
...
}
export default Marty.register(LibrariesStore)
Then
import librariesStore from '../../stores/libraries.es6';
export default Marty.createContainer(Main, {
listenTo: librariesStore,
...
})
But Marty 0.10 is quite different
Thank you... What I was doing wrong is, I had listenTo: "librariesStore",
(string) in my code instead of listenTo: librariesStore,
(object).
I thought that Marty kept track of our stores and I just had to provide its name (the one I set as its id). I was wrong... Now all seems to work.
I'm using ES6 and declaring my store like:
Then in my component I import the store and try to use it in a container:
In the browser I see:
So I see I'm importing the LibrariesStore class. But there is no instance created anywhere. So something seems to be missing here, where is the store instance supposed to be instantiated?