Discussion
Discussion copied to clipboard
Best practice for organizing hundreds of component?
When you have a big application which have hundreds components, some of it is heavily shared by others, and some of it just a layout or a simple view. So is there any good advises for organizing components? by module? or by usage? or some other policies?
It may sound cliche but honestly it really depends on your project and your preference. Mostly there are two types of components: view-specific, and view-agnostic (reusable/shared/whatever). I usually organize the first type by the view hierarchy. e.g. all components specifically used in a page goes into a folder named after that page. If a sub view is only used by a parent view, then nest the sub view under the parent view's folder. Then, view-agnostic components obviously go into a dedicated folder.
@yyx990803 It is very nice of you to share your opnions. It makes a lot of sense. I am starting to use VueJS at my work today. Do you still organize your components this way?