Answer the question
In order to leave comments, you need to log in
Vuex reusable modules. Best practice?
Hi all.
I'll try to explain briefly (if you need to clarify anything)
1. We have a list of objects (let's say questions)
2. Each question is rendered in the question component
3. I want to make a Store for each question
4. How I try:
In the question component in the mounted method (or created?) I register the module like this
this.namespace = 'question-' + this.question.id
this.store.
registerModule(this.namespace, questionStore)
Answer the question
In order to leave comments, you need to log in
Why do you need a separate repository for each question? Here you need 1 storage questions with an array of questions, then just create a loop in the template and display all the questions
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question