You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/learn/describing-the-ui.md
+44-45
Original file line number
Diff line number
Diff line change
@@ -1,29 +1,29 @@
1
1
---
2
-
title: Describing the UI
2
+
title: UI 표현하기
3
3
---
4
4
5
5
<Intro>
6
6
7
-
React is a JavaScript library for rendering user interfaces (UI). UI is built from small units like buttons, text, and images. React lets you combine them into reusable, nestable *components.* From web sites to phone apps, everything on the screen can be broken down into components. In this chapter, you'll learn to create, customize, and conditionally display React components.
7
+
React는 사용자 인터페이스(UI)를 렌더링하기 위한 JavaScript 라이브러리입니다. UI는 버튼, 텍스트, 이미지와 같은 작은 요소로 구성됩니다. React를 통해 작은 요소들을 재사용 가능하고 중첩할 수 있는 *컴포넌트*로 조합할 수 있습니다. 웹 사이트에서 휴대전화 앱에 이르기까지 화면에 있는 모든 것을 컴포넌트로 나눌 수 있습니다. 이 장에서는 React 컴포넌트를 만들고, 사용자화하며, 조건부로 표시하는 방법에 대해서 알아봅시다.
8
8
9
9
</Intro>
10
10
11
11
<YouWillLearnisChapter={true}>
12
12
13
-
*[How to write your first React component](/learn/your-first-component)
14
-
*[When and how to create multi-component files](/learn/importing-and-exporting-components)
15
-
*[How to add markup to JavaScript with JSX](/learn/writing-markup-with-jsx)
16
-
*[How to use curly braces with JSX to access JavaScript functionality from your components](/learn/javascript-in-jsx-with-curly-braces)
17
-
*[How to configure components with props](/learn/passing-props-to-a-component)
18
-
*[How to conditionally render components](/learn/conditional-rendering)
19
-
*[How to render multiple components at a time](/learn/rendering-lists)
20
-
*[How to avoid confusing bugs by keeping components pure](/learn/keeping-components-pure)
## Your first component {/*your-first-component*/}
24
+
## 첫 컴포넌트 {/*your-first-component*/}
25
25
26
-
React applications are built from isolated pieces of UI called *components*. A React component is a JavaScript function that you can sprinkle with markup. Components can be as small as a button, or as large as an entire page. Here is a `Gallery`component rendering three`Profile`components:
26
+
React 애플리케이션은 *컴포넌트*라고 불리는 독립된 UI 조각들로 이루어집니다. React 컴포넌트는 마크업을 얹을 수 있는 JavaScript 함수입니다. 컴포넌트는 버튼과 같이 작을 수도 있고 전체 페이지와 같이 큰 경우도 있습니다. 다음의 `Gallery`컴포넌트는 세 개의`Profile`컴포넌트를 렌더링하고 있습니다.
Read **[Your First Component](/learn/your-first-component)**to learn how to declare and use React components.
60
+
React 컴포넌트를 선언하고 사용하는 방법을 배우려면 **[첫 컴포넌트](/learn/your-first-component)**를 읽어보세요.
61
61
62
62
</LearnMore>
63
63
64
-
## Importing and exporting components {/*importing-and-exporting-components*/}
65
-
66
-
You can declare many components in one file, but large files can get difficult to navigate. To solve this, you can *export* a component into its own file, and then *import* that component from another file:
64
+
## 컴포넌트 Import 및 Export 하기 {/*importing-and-exporting-components*/}
67
65
66
+
하나의 파일에 많은 컴포넌트를 선언할 수 있지만, 파일이 커지면 탐색하기 어려워집니다. 이를 해결하기 위해 컴포넌트를 별도의 파일로 만들어 *export*하고 다른 파일에서 해당 컴포넌트를 *import*할 수 있습니다.
Read **[Importing and Exporting Components](/learn/importing-and-exporting-components)**to learn how to split components into their own files.
114
+
컴포넌트를 개별 파일로 분리하는 방법을 배우려면 **[컴포넌트 Import 및 Export 하기](/learn/importing-and-exporting-components)**를 읽어보세요.
116
115
117
116
</LearnMore>
118
117
119
-
## Writing markup with JSX {/*writing-markup-with-jsx*/}
118
+
## JSX로 마크업 작성하기 {/*writing-markup-with-jsx*/}
120
119
121
-
Each React component is a JavaScript function that may contain some markup that React renders into the browser. React components use a syntax extension called JSX to represent that markup. JSX looks a lot like HTML, but it is a bit stricter and can display dynamic information.
120
+
React 컴포넌트는 React가 브라우저에 렌더링하는 마크업을 포함할 수 있는 JavaScript 함수입니다. React 컴포넌트는 그 마크업을 표현하기 위해 JSX라는 확장된 문법을 사용합니다. JSX는 HTML과 매우 유사하지만 조금 더 엄격하며 동적인 정보를 표시할 수 있습니다.
122
121
123
-
If we paste existing HTML markup into a React component, it won't always work:
122
+
기존의 HTML 마크업을 React 컴포넌트에 그대로 붙여넣으면 동작하지 않을 수도 있습니다.
124
123
125
124
<Sandpack>
126
125
@@ -149,7 +148,7 @@ img { height: 90px; }
149
148
150
149
</Sandpack>
151
150
152
-
If you have existing HTML like this, you can fix it using a [converter](https://transform.tools/html-to-jsx):
151
+
만약 이미 만들어진 HTML 마크업이 있다면 [converter](https://transform.tools/html-to-jsx)를 사용하여 변환할 수 있습니다.
153
152
154
153
<Sandpack>
155
154
@@ -181,13 +180,13 @@ img { height: 90px; }
181
180
182
181
<LearnMorepath="/learn/writing-markup-with-jsx">
183
182
184
-
Read **[Writing Markup with JSX](/learn/writing-markup-with-jsx)**to learn how to write valid JSX.
183
+
올바르게 JSX를 작성하는 방법을 배우려면 **[JSX로 마크업 작성하기](/learn/writing-markup-with-jsx)**를 읽어보세요.
185
184
186
185
</LearnMore>
187
186
188
-
## JavaScript in JSX with curly braces {/*javascript-in-jsx-with-curly-braces*/}
187
+
## JSX에서 중괄호를 이용하여 JavaScript 사용하기 {/*javascript-in-jsx-with-curly-braces*/}
189
188
190
-
JSX lets you write HTML-like markup inside a JavaScript file, keeping rendering logic and content in the same place. Sometimes you will want to add a little JavaScript logic or reference a dynamic property inside that markup. In this situation, you can use curly braces in your JSX to "open a window" to JavaScript:
189
+
JSX를 사용하면 JavaScript 파일에 HTML과 비슷한 마크업을 작성할 수 있어 렌더링 로직과 콘텐츠를 같은 곳에 둘 수 있습니다. 때로는 그 마크업 내부에 JavaScript 로직을 추가하거나 동적인 프로퍼티를 참조해야 하는 경우가 있습니다. 그럴 때 JSX에서 중괄호를 사용하여 JavaScript와 연결된 "창문을 열 수" 있습니다.
191
190
192
191
<Sandpack>
193
192
@@ -229,13 +228,13 @@ body > div > div { padding: 20px; }
React components use *props* to communicate with each other. Every parent component can pass some information to its child components by giving them props. Props might remind you of HTML attributes, but you can pass any JavaScript value through them, including objects, arrays, functions, and even JSX!
237
+
React 컴포넌트는 서로 통신하기 위해 *props*를 사용합니다. 모든 부모 컴포넌트는 자식 컴포넌트에 props를 제공하여 정보를 전달할 수 있습니다. Props는 HTML 어트리뷰트와 유사해 보이지만 객체, 배열, 함수를 포함한 모든 JavaScript 값이 전달될 수 있습니다. 심지어 JSX도 가능합니다!
Your components will often need to display different things depending on different conditions. In React, you can conditionally render JSX using JavaScript syntax like `if`statements, `&&`, and`? :`operators.
318
+
컴포넌트는 조건에 따라 다른 항목을 표시해야 하는 경우가 많습니다. React는 `if`문, `&&` 및`? :`연산자와 같은 자바스크립트 문법을 사용하여 JSX를 조건부로 렌더링할 수 있습니다.
320
319
321
-
In this example, the JavaScript `&&`operator is used to conditionally render a checkmark:
320
+
이 예제에서는 JavaScript `&&`연산자를 사용하여 체크 표시를 조건부로 렌더링합니다.
322
321
323
322
<Sandpack>
324
323
@@ -358,15 +357,15 @@ export default function PackingList() {
358
357
359
358
<LearnMore path="/learn/conditional-rendering">
360
359
361
-
Read **[Conditional Rendering](/learn/conditional-rendering)** to learn the different ways to render content conditionally.
360
+
**[조건부 렌더링](/learn/conditional-rendering)** 을 통해 콘텐츠를 조건부로 렌더링하는 다양한 방법을 배울 수 있습니다.
362
361
363
362
</LearnMore>
364
363
365
-
## Rendering lists {/*rendering-lists*/}
364
+
## 리스트 렌더링 {/*rendering-lists*/}
366
365
367
-
You will often want to display multiple similar components from a collection of data. You can use JavaScript's `filter()` and `map()`with React to filter and transform your array of data into an array of components.
366
+
데이터 모음으로부터 유사한 컴포넌트를 여러 개 표시하고 싶을 때가 종종 있습니다. React와 JavaScript의 `filter()`와 `map()`을 함께 사용하면 데이터 배열을 필터링하고 컴포넌트 배열로 변환할 수 있습니다.
368
367
369
-
For each array item, you will need to specify a `key`. Usually, you will want to use an ID from the database as a `key`. Keyslet React keep track of each item's place in the list even if the list changes.
368
+
각 배열 항목마다 `key`를 지정해야 합니다. 일반적으로 데이터베이스에서 가져온 ID를 `key`로 사용하게 될 것입니다. Key를 사용하면 리스트가 변경되더라도 React가 각 항목의 위치를 추적할 수 있습니다.
370
369
371
370
<Sandpack>
372
371
@@ -458,18 +457,18 @@ h2 { font-size: 20px; }
458
457
459
458
<LearnMorepath="/learn/rendering-lists">
460
459
461
-
Read **[Rendering Lists](/learn/rendering-lists)**to learn how to render a list of components, and how to choose a key.
460
+
컴포넌트 목록을 렌더링하는 방법과 어떻게 key를 선택하는지에 대해 배우려면 **[리스트 렌더링](/learn/rendering-lists)**을 읽어보세요.
462
461
463
462
</LearnMore>
464
463
465
-
## Keeping components pure {/*keeping-components-pure*/}
464
+
## 컴포넌트 순수하게 유지하기 {/*keeping-components-pure*/}
466
465
467
-
Some JavaScript functions are *pure.* A pure function:
466
+
어떤 JavaScript 함수는 *순수*합니다. 순수 함수는 다음과 같은 특징이 있습니다.
468
467
469
-
***Minds its own business.**It does not change any objects or variables that existed before it was called.
470
-
***Same inputs, same output.**Given the same inputs, a pure function should always return the same result.
468
+
***자신의 일만 처리합니다.**호출되기 전에 존재했던 어떤 객체나 변수도 변경하지 않습니다.
469
+
***입력이 같으면 출력도 같습니다.**순수 함수는 같은 입력을 받으면 언제나 같은 결과를 반환해야 합니다.
471
470
472
-
By strictly only writing your components as pure functions, you can avoid an entire class of baffling bugs and unpredictable behavior as your codebase grows. Here is an example of an impure component:
471
+
컴포넌트를 엄격하게 순수 함수로만 작성하면 코드 베이스가 커져도 이해하기 어려운 버그와 예측할 수 없는 동작을 피할 수 있습니다. 다음은 순수하지 않은 컴포넌트의 예시입니다.
473
472
474
473
<Sandpack>
475
474
@@ -495,7 +494,7 @@ export default function TeaSet() {
495
494
496
495
</Sandpack>
497
496
498
-
You can make this component pure by passing a prop instead of modifying a preexisting variable:
497
+
기존 변수를 수정하는 대신 prop을 전달하여 컴포넌트를 순수하게 만들 수 있습니다.
499
498
500
499
<Sandpack>
501
500
@@ -519,12 +518,12 @@ export default function TeaSet() {
519
518
520
519
<LearnMorepath="/learn/keeping-components-pure">
521
520
522
-
Read **[Keeping Components Pure](/learn/keeping-components-pure)**to learn how to write components as pure, predictable functions.
521
+
컴포넌트를 순수하고 예측 가능한 함수로 작성하는 방법을 배우려면 **[컴포넌트 순수하게 유지하기](/learn/keeping-components-pure)**를 읽어보세요.
523
522
524
523
</LearnMore>
525
524
526
525
## What's next? {/*whats-next*/}
527
526
528
-
Head over to [Your First Component](/learn/your-first-component)to start reading this chapter page by page!
527
+
[첫 컴포넌트](/learn/your-first-component)페이지로 이동하여 이 장을 페이지별로 읽어보세요!
529
528
530
-
Or, if you're already familiar with these topics, why not read about [Adding Interactivity](/learn/adding-interactivity)?
529
+
이미 이러한 주제에 대해 알고 있다면 [상호작용 추가하기](/learn/adding-interactivity)를 읽어보는 것은 어떨까요?
0 commit comments