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
*`value`: The`value` you want to check. It can be any a value of any type.
42
+
`value`: 확인하려는`value`입니다. 모든 종류의 값이 될 수 있습니다.
43
43
44
-
#### Returns {/*returns*/}
44
+
#### 반환 {/*returns*/}
45
45
46
-
`isValidElement` returns `true` if the `value` is a React element. Otherwise, it returns `false`.
46
+
`isValidElement`는 `value`가 React 엘리먼트인 경우 `true`를 반환합니다. 그렇지 않으면 `false`를 반환합니다.
47
47
48
-
#### Caveats {/*caveats*/}
48
+
#### 주의사항 {/*caveats*/}
49
49
50
-
***Only [JSX tags](/learn/writing-markup-with-jsx) and objects returned by [`createElement`](/reference/react/createElement) are considered to be React elements.**For example, even though a number like `42` is a valid React *node* (and can be returned from a component), it is not a valid React element. Arrays and portals created with [`createPortal`](/reference/react-dom/createPortal) are also *not* considered to be React elements.
50
+
***[`createElement`](/reference/react/createElement)가 반환한 [JSX 태그](/learn/writing-markup-with-jsx)와 객체는 React 엘리먼트로 간주합니다.**예를 들어, `42`와 같은 숫자는 유효한 React *노드* (컴포넌트에서 반환될 수 있지만)이지만, 유효한 React 엘리먼트는 아닙니다. [`createPortal`](/reference/react-dom/createPortal)로 만들어진 배열과 portal도 React 엘리먼트로 간주하지 *않습니다*.
51
51
52
52
---
53
53
54
-
## Usage {/*usage*/}
54
+
## 사용법 {/*usage*/}
55
55
56
-
### Checking if something is a React element {/*checking-if-something-is-a-react-element*/}
56
+
### 어떤 것이 React 엘리먼트인지 확인하기 {/*checking-if-something-is-a-react-element*/}
57
57
58
-
Call `isValidElement` to check if some value is a *React element.*
58
+
어떤 값이 React 엘리먼트인지 확인하려면 `isValidElement`를 호출해 보세요.
59
59
60
-
React elements are:
60
+
React 엘리먼트는 다음과 같습니다.
61
61
62
-
-Values produced by writing a [JSX tag](/learn/writing-markup-with-jsx)
63
-
-Values produced by calling [`createElement`](/reference/react/createElement)
62
+
-[JSX tag](/learn/writing-markup-with-jsx)를 작성하여 생성된 값
63
+
-[`createElement`](/reference/react/createElement)를 호출하여 생성된 값
64
64
65
-
For React elements, `isValidElement` returns `true`:
It is very uncommon to need `isValidElement`. It's mostly useful if you're calling another API that *only* accepts elements (like [`cloneElement`](/reference/react/cloneElement) does) and you want to avoid an error when your argument is not a React element.
93
+
`isValidElement`가 필요한 경우는 매우 드뭅니다. 주로 "엘리먼트만" 허용하는 다른 API를 호출할 때와 ([`cloneElement`](/reference/react/cloneElement)가 하는 것처럼) 인수가 React 엘리먼트가 아닌 경우 오류를 피하고 싶을 때 유용합니다.
94
94
95
-
Unless you have some very specific reason to add an `isValidElement` check, you probably don't need it.
95
+
`isValidElement`확인을 추가 해야 하는 구체적인 이유가 없는 한 이 확인은 필요하지 않을 수 있습니다.
96
96
97
97
<DeepDive>
98
98
99
-
#### React elements vs React nodes {/*react-elements-vs-react-nodes*/}
99
+
#### React 엘리먼트 vs React 노드 {/*react-elements-vs-react-nodes*/}
100
100
101
-
When you write a component, you can return any kind of *React node* from it:
101
+
컴포넌트를 작성할 때 모든 종류의 *React 노드*를 반환할 수 있습니다.
102
102
103
103
```js
104
104
functionMyComponent() {
105
-
// ... you can return any React node ...
105
+
// ... React 노드를 반환할수 있습니다. ...
106
106
}
107
107
```
108
108
109
-
A React node can be:
109
+
React 노드는 다음과 같습니다.
110
+
-`<div />` 또는 `createElement('div')`와 같이 생성된 React 엘리먼트입니다.
111
+
-[`createPortal`](/reference/react-dom/createPortal)로 생성된 portal입니다.
112
+
- 문자열
113
+
- 숫자
114
+
-`true`, `false`, `null`, 또는 `undefined` (표시되지 않는 경우)
115
+
- 다른 React 노드의 배열
110
116
111
-
- A React element created like `<div />` or `createElement('div')`
112
-
- A portal created with [`createPortal`](/reference/react-dom/createPortal)
113
-
- A string
114
-
- A number
115
-
-`true`, `false`, `null`, or `undefined` (which are not displayed)
116
-
- An array of other React nodes
117
-
118
-
**Note `isValidElement` checks whether the argument is a *React element,* not whether it's a React node.** For example, `42` is not a valid React element. However, it is a perfectly valid React node:
117
+
**주의 `isValidElement`는 인수가 React 노드의 여부가 아니라 *React 엘리먼트*의 여부를 확인합니다.** 예를 들어 `42`는 유효한 React 엘리먼트가 아닙니다. 하지만 완벽하게 유효한 React 노드입니다.
119
118
120
119
```js
121
120
functionMyComponent() {
122
-
return42; //It's ok to return a number from component
121
+
return42; //컴포넌트에서 숫자를 반환해도 괜찮습니다.
123
122
}
124
123
```
125
124
126
-
This is why you shouldn't use `isValidElement` as a way to check whether something can be rendered.
125
+
이것이 무언가를 렌더링할 수 있는지 확인하는 여부로 `isValidElement`를 사용해서는 안 되는 이유입니다.
0 commit comments