W
W
Worddoc2017-10-06 12:18:22
JavaScript
Worddoc, 2017-10-06 12:18:22

When to use ES6 Class?

Hello.
The question arose, in what cases is the use of ES6 Classes more appropriate?
Let's take 2 cases:
1) A typical website with ajax transitions. Simple widgets: popups, sliders, filters, lightboxes, galleries, search and more. No frameworks or interface design patterns are used.
2) Web application in relatively speaking angular/react/vue/someAnotherHype.js etc. The interface is divided into components.
2.1) PS Is it normal to have components as classes?
I would like to understand the essence of using ES6 classes when creating web sites, because I can not find a place to use classes when creating interfaces, given that most components differ from each other in functionality and have little in common.
I understand that if I don’t see where to use them, then I don’t need it. But I want to learn this so that I can improve my way of thinking when creating websites and web interfaces.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Bogachev, 2017-10-06
@sfi0zy

Is it normal to have components as classes?

"Normality" is a term from the field of psychiatry, denoting the fact that someone else does what we at a given moment in time and in this society consider acceptable. There were times when people said "we should separate markup, styles and scripts and never mix them". This was considered normal. Even related to good practices. And then there was react. And the same people began to say "yes, let's do everything in one file, it's cool, and you can also compress the entire project with all the resources into one bundle with webpack." And now it's the norm. As you can see, the normality has changed a bit.
Have a look at my bike . It is still far from perfect and is rather a testing ground for experiments, but it just clearly shows what happens in the code when using component classes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question