You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1.2 KiB

id title layout permalink prev next
references-to-components-ko-KR 컴포넌트 참조 tips references-to-components-ko-KR.html expose-component-functions-ko-KR.html children-undefined-ko-KR.html

애플리케이션의 일부에서만 React 컴포넌트를 사용중이거나 코드를 React로 전환하고 있다면, 컴포넌트의 참조를 보존할 필요가 있을 것입니다. React.render는 마운트된 컴포넌트의 참조를 반환합니다:

var myComponent = React.render(<MyComponent />, myContainer);

명심하세요, JSX는 컴포넌트 인스턴스를 반환하지 않습니다! 단지 마운트된 컴포넌트가 어떻게 보일지 알려주는 간단한 서술인 ReactElement일 뿐입니다.

var myComponentElement = <MyComponent />; // ReactElement일 뿐입니다.

// 코드들이 여기 위치하게 됩니다...

var myComponentInstance = React.render(myComponentElement, myContainer);

주의:

이는 최상위 레벨에서만 사용되어야 합니다. 컴포넌트의 내부에서는 propstate가 자식컴포넌트와의 통신을 제어하며, refs를 통해서만 컴포넌트를 참조할 수 있습니다.