S
S
sir_pounce2020-06-30 10:18:13
Vue.js
sir_pounce, 2020-06-30 10:18:13

How many components should a vue app be divided into?

Actually the question itself - is it necessary to take out everything that is possible in the components? For example, an authorization form component, it has inputs and a button, should these inputs and the button be made components? And how to understand what exactly should be a component, and what can remain part of the parent component's code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2020-06-30
@sir_pounce

  • If an element needs to be used more than once, make it a separate component
  • If your parent component is very large, break it into several smaller components, purely for convenience.
  • If you assume that some part of your program will change frequently, move it to a separate module.
  • If you have a large piece of static content, put it in a separate component
  • If some element has a very complex or time-consuming logic, move it to a separate component.

In general, I try to make a lot of small components. I feel so much more comfortable. But most importantly without fanaticism. You don't need a separate component for each input, unless that input needs some kind of encapsulated logic or styling.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question