T
T
tantumus212021-11-23 16:04:52
Angular
tantumus21, 2021-11-23 16:04:52

Is it necessary to split the page into components that do not carry any functionality?

The page consists of several blocks and looks something like this<section>

section
--h1
--p
--form
section
--ul
----li (список динамически формируется)
section
--p
--p
--p


And the question is this. Do I need to make each of the sections a separate component to simplify the page? Otherwise, there is too much markup.
Let's say that in the first section I will design the form as a separate component - it has its own functionality, validation, sending. Do I need to style the section itself as a component?
The second section contains only dynamic content - will be a component.
Or the third section, which consists of several paragraphs and that's it. Should I make it a separate component in order to simplify the markup of the component in which it is located.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
tehfreak, 2021-11-23
@tehfreak

In the general case, it should be taken out into separate components in order to be able to reuse these components. And also for the sake of encapsulation and localization of layout and logic, including to simplify the understanding of the parent component.

M
Miki06, 2021-11-25
@Miki06

it’s a matter of taste, but usually those elements that will be reused somewhere else are taken out into separate components

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question