Closed luski closed 7 years ago
Hello,
prepareStore only works with the develop branch, not in the package currently published to atmosphere!
Oh I see, thanks. Is there any other way to render data from the db using the currently published package?
Yes, you have the global collection method. The problem is that you have to load the contents of the entire collection upfront. The router started being made for a very specific purpose so it was the only way to load data when we started. There are example in the demo of the master branch. Or, you can simply clone the develop branch in your packages folder so you can use the prepareStore methods. But, it is indeed a work in progess, so you might encounter a few bugs. I use it, and it's quite fine. But be ready to struggle a little if you decide to use it.
Thanks for explanation :+1:
I have a question. I created an almost empty project with
createRouter
on server-side and client-side. Everything works, the main page is rendered correctly on the client and server side. Now I wanted to display some data from the mongodb. So AFAIK, to do it on the server side I should implement the prepareStore method, right? So I added to my main component:just to test if the prepareStore will be called. And it's not - I can't see any console log on the server. What should I do to make the prepareStore be called?