Vue.js 3 Complete Guide [2/10]

OnlyKiosk Dev Tech
20 min readSep 14, 2021

Next, let’s try the factory pattern. It returns us the opposite result as the singleton pattern.

We create a function. We name it infoFactory. Inside it, we return an object. In the returned object, we set the city property and set its value to London as well.

The returned object is defined inside the factory function. Every time we run the factory function, it returns us a new object. In other words, every time we run the factory function, we receive a new memory address.

--

--