When I use my pattern factory for my slider, it returns me "[object Object]" instead of having HTML. Class code
Do you have any idea what could happen?
Thank you so much :)
Contructor cann't return anything, but the object he creates and returns internally. To avoid this behavior use something like.
class MediaFactory {
getContent(data, layout) {
// your code goes here
}
}
and usage will be
....innerHtml = new MediaFactory().getContent(article, 'slider')