When do you reuse modules?

Posted by Jennifer | Updated on

Sometime you may need to create multiple instances of a module.

For example, it is needed in the below cases,

  1. If multiple stores that use the same module
  2. Register the same module multiple times in the same store.

In those cases, you need to assign to a variable and export it for reusability, javascript const MyReusableModule = { // state // mutations, actions, getters... }

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers