diff --git a/content/docs/jsx-in-depth.md b/content/docs/jsx-in-depth.md index eb3dc3a5b..bc7d5dba9 100644 --- a/content/docs/jsx-in-depth.md +++ b/content/docs/jsx-in-depth.md @@ -1,6 +1,6 @@ --- id: jsx-in-depth -title: JSX In Depth +title: JSX 이해하기 permalink: docs/jsx-in-depth.html redirect_from: - "docs/jsx-spread.html" @@ -13,7 +13,7 @@ redirect_from: - "docs/jsx-in-depth-ko-KR.html" --- -Fundamentally, JSX just provides syntactic sugar for the `React.createElement(component, props, ...children)` function. The JSX code: +근본적으로, JSX는 `React.createElement(component, props, ...children)` 함수에 대한 문법적 설탕을 제공할 뿐입니다. ```js @@ -21,7 +21,7 @@ Fundamentally, JSX just provides syntactic sugar for the `React.createElement(co ``` -compiles into: +위의 코드는 아래와 같이 컴파일됩니다. ```js React.createElement( @@ -31,13 +31,13 @@ React.createElement( ) ``` -You can also use the self-closing form of the tag if there are no children. So: +자식 컴포넌트가 없다면 아래와 같이 자기 자신을 닫는 형태의 태그를 쓸 수 있습니다. ```js
``` -compiles into: +위의 코드는 아래와 같이 컴파일 됩니다. ```js React.createElement( @@ -47,19 +47,20 @@ React.createElement( ) ``` -If you want to test out how some specific JSX is converted into JavaScript, you can try out [the online Babel compiler](babel://jsx-simple-example). +특정 JSX가 어떻게 JavaScript로 변환되는지 시험해보고 싶다면 [온라인 babel 컴파일러](babel://jsx-simple-example)를 사용해보세요. -## Specifying The React Element Type {#specifying-the-react-element-type} +## React Element의 타입 지정하기 {#specifying-the-react-element-type} -The first part of a JSX tag determines the type of the React element. +JSX 태그의 첫 부분은 React element의 타입을 결정합니다. -Capitalized types indicate that the JSX tag is referring to a React component. These tags get compiled into a direct reference to the named variable, so if you use the JSX `` expression, `Foo` must be in scope. +대문자로 시작하는 JSX 태그는 React 컴포넌트를 지정합니다. 이 태그들은 같은 이름을 가진 변수들을 직접 참조합니다. 만약 ``와 같은 JSX 표현을 쓰려고 한다면 Foo가 반드시 스코프 내에 존재해야 합니다. -### React Must Be in Scope {#react-must-be-in-scope} -Since JSX compiles into calls to `React.createElement`, the `React` library must also always be in scope from your JSX code. +### React가 스코프 내에 존재해야 합니다 {#react-must-be-in-scope} -For example, both of the imports are necessary in this code, even though `React` and `CustomButton` are not directly referenced from JavaScript: +JSX는 `React.createElement`를 호출하는 코드로 컴파일 되기 때문에 `React` 라이브러리 역시 JSX 코드와 같은 스코프 내에 존재해야만 합니다. + +아래의 예시를 통해 보면, `React`와 `CustomButton`는 JavaScript 코드에선 직접적으로 사용되진 않지만 JSX 태그로 사용하기 위해 꼭 import 해야합니다. ```js{1,2,5} import React from 'react'; @@ -71,11 +72,11 @@ function WarningButton() { } ``` -If you don't use a JavaScript bundler and loaded React from a `