From 4a30af57aef09e6a5100327ba48ac43b78e732d6 Mon Sep 17 00:00:00 2001 From: simsim0709 Date: Tue, 12 Mar 2019 00:36:42 +0900 Subject: [PATCH] Translate unknown-prop --- content/warnings/unknown-prop.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/content/warnings/unknown-prop.md b/content/warnings/unknown-prop.md index 783d1b385..4e4147a79 100644 --- a/content/warnings/unknown-prop.md +++ b/content/warnings/unknown-prop.md @@ -3,37 +3,37 @@ title: Unknown Prop Warning layout: single permalink: warnings/unknown-prop.html --- -The unknown-prop warning will fire if you attempt to render a DOM element with a prop that is not recognized by React as a legal DOM attribute/property. You should ensure that your DOM elements do not have spurious props floating around. +올바른 DOM 어트리뷰트/프로퍼티로 인식되지 않는 DOM 엘리먼트를 렌더링하려고 하면 unknown-prop 경고가 발생합니다. DOM 엘리먼트에 잘못된 props가 추가되지 않도록 해야 합니다. -There are a couple of likely reasons this warning could be appearing: +이 경고가 표시되는 몇 가지 이유가 있습니다. -1. Are you using `{...this.props}` or `cloneElement(element, this.props)`? Your component is transferring its own props directly to a child element (eg. [transferring props](/docs/transferring-props.html)). When transferring props to a child component, you should ensure that you are not accidentally forwarding props that were intended to be interpreted by the parent component. +1. `{...this.props}` 또는 `cloneElement(element, this.props)`를 사용하고 있습니까? 그렇다면 컴포넌트가 자기 자신의 props를 자식 엘리먼트로 직접 전달하는 경우입니다. (예시. [props 전달](/docs/transferring-props.html)) 자식 컴포넌트로 props를 전달할 때 부모 컴포넌트에서 사용되는 props를 실수로 전달하지 않도록 해야 합니다. -2. You are using a non-standard DOM attribute on a native DOM node, perhaps to represent custom data. If you are trying to attach custom data to a standard DOM element, consider using a custom data attribute as described [on MDN](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes). +2. 사용자 정의 데이터를 나타내기 위해 네이티브 DOM 노드에서 비표준 DOM 어트리뷰트를 사용하고 있는 경우입니다. 표준 DOM 엘리먼트에 사용자 정의 데이터를 추가하려는 경우 [MDN](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Using_data_attributes)에 설명된 사용자 정의 data 어트리뷰트를 사용해보세요. -3. React does not yet recognize the attribute you specified. This will likely be fixed in a future version of React. However, React currently strips all unknown attributes, so specifying them in your React app will not cause them to be rendered. +3. React가 아직 지정된 어트리뷰트를 인식하지 못하는 경우입니다. 이것은 다음 React 버전에서 수정될 수 있습니다. 그러나 React는 현재 알 수 없는 모든 어트리뷰트를 제거하므로 React 앱에서 렌더링되지 않습니다. -4. You are using a React component without an upper case. React interprets it as a DOM tag because [React JSX transform uses the upper vs. lower case convention to distinguish between user-defined components and DOM tags](/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized). +4. React 컴포넌트 이름에 대문자가 포함되어 있지 않은 경우입니다. [React JSX에서는 대소문자 규칙을 사용하여 사용자 정의 컴포넌트와 DOM 태그를 구별](/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized)하기 때문에 React 컴포넌트에 대문자가 없다면 이것을 DOM 태그로 해석합니다. --- -To fix this, composite components should "consume" any prop that is intended for the composite component and not intended for the child component. Example: +이 문제를 해결하려면, 합성 컴포넌트는 자식 컴포넌트를 위해 만들어진 것이 아닌 합성 컴포넌트를 위해 만들어진 모든 props를 "소비해야 합니다". 예를 들어, -**Bad:** Unexpected `layout` prop is forwarded to the `div` tag. +**금지** 예기치 않은 `layout` prop이 `div` 태그에 전달됩니다. ```js function MyDiv(props) { if (props.layout === 'horizontal') { - // BAD! Because you know for sure "layout" is not a prop that
understands. + // 금지! "layout"은
가 이해하는 prop이 아니기 때문입니다. return
} else { - // BAD! Because you know for sure "layout" is not a prop that
understands. + // 금지! "layout"은
가 이해하는 prop이 아니기 때문입니다. return
} } ``` -**Good:** The spread operator can be used to pull variables off props, and put the remaining props into a variable. +**권장** 전개 연산자(spread operator)를 사용하여 변수를 props에서 빼내고 나머지 props를 변수에 넣을 수 있습니다. ```js function MyDiv(props) { @@ -46,7 +46,7 @@ function MyDiv(props) { } ``` -**Good:** You can also assign the props to a new object and delete the keys that you're using from the new object. Be sure not to delete the props from the original `this.props` object, since that object should be considered immutable. +**권장** 새 객체에 props를 복사하고 새 객체에서 사용 중인 key를 삭제할 수도 있습니다. 원래 `this.props` 객체에서 그 객체를 삭제하면 안됩니다. 왜냐하면 그 객체는 불변이어야 하기 때문입니다. ```js function MyDiv(props) {