Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

스타일 가이드 - 강한 연관성을 가진 컴포넌트 이름 #27

Open
Bogyie opened this issue Nov 9, 2022 · 0 comments
Open
Assignees

Comments

@Bogyie
Copy link
Member

Bogyie commented Nov 9, 2022

### 강한 연관성을 가진 컴포넌트 이름 <sup data-p="b">매우 추천함</sup>
**Child components that are tightly coupled with their parent should include the parent component name as a prefix.**
If a component only makes sense in the context of a single parent component, that relationship should be evident in its name. Since editors typically organize files alphabetically, this also keeps these related files next to each other.
{% raw %}
<details>
<summary>
<h4>자세한 설명</h4>
</summary>
{% endraw %}
You might be tempted to solve this problem by nesting child components in directories named after their parent. For example:
```
components/
|- TodoList/
|- Item/
|- index.vue
|- Button.vue
|- index.vue
```
or:
```
components/
|- TodoList/
|- Item/
|- Button.vue
|- Item.vue
|- TodoList.vue
```
This isn't recommended, as it results in:
- Many files with similar names, making rapid file switching in code editors more difficult.
- Many nested sub-directories, which increases the time it takes to browse components in an editor's sidebar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant