S
S
someserj2018-02-22 16:24:32
React
someserj, 2018-02-22 16:24:32

Should everything in React be components?

for example, a page header with a logo and some text. I don't think it should be made a component, or am I wrong? how to do it right in React?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim, 2018-02-22
@someserj

React can be embedded into an existing production site. For example, there is some kind of complex table for translators with a bunch of logic - this is where the react is. They stuck it in, did not touch the site itself (let it be written at least on ruby ​​templates) - they rolled it out.
Another thing is when you initially have a React SPA application. Then there is no point in doing a header / page with a logo and so on not in react. It's convenient when everything is in the components.

T
ThemeZV, 2018-02-22
@ThemeZ

The main purpose of components is to reuse ready-made ones.
If there is one header/footer everywhere, then there is no need to split it into separate components.
If something is reused, it needs to be moved to a separate one.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question