React DOM 컴포넌트
공통 컴포넌트
브라우저에 내장된 모든 컴포넌트는 일부 Props와 이벤트를 지원합니다.
ref와 dangerouslySetInnerHTML같은 React 고유의 Props를 포함합니다.
폼Form 컴포넌트
다음과 같은 브라우저에 내장된 컴포넌트는 사용자 입력을 받습니다.
value 프로퍼티를 전달하여 제어할 수 있기 때문에 React에서 특별합니다.
Resource and Metadata Components
다음 브라우저 컴포넌트들을 사용하면 외부 리소스를 로드하거나 메타데이터로 문서에 주석을 달 수 있습니다.
위 컴포넌트들은 React에서 특별하게 다뤄집니다. React는 위 컴포넌트들을 document head 내부에 렌더링하고, 리소스를 불러올 동안 일시 중단하고, 각 특정 구성 요소의 참조 페이지에 설명된 다른 동작을 시행합니다.
모든 HTML 컴포넌트
React는 브라우저에 내장된 모든 HTML 컴포넌트를 지원합니다. 이는 다음과 같은 컴포넌트들을 포함합니다.
<aside><audio><b><base><bdi><bdo><blockquote><body><br><button><canvas><caption><cite><code><col><colgroup><data><datalist><dd><del><details><dfn><dialog><div><dl><dt><em><embed><fieldset><figcaption><figure><footer><form><h1><head><header><hgroup><hr><html><i><iframe><img><input><ins><kbd><label><legend><li><link><main><map><mark><menu><meta><meter><nav><noscript><object><ol><optgroup><option><output><p><picture><pre><progress><q><rp><rt><ruby><s><samp><script><section><select><slot><small><source><span><strong><style><sub><summary><sup><table><tbody><td><template><textarea><tfoot><th><thead><time><title><tr><track><u><ul><var><video><wbr>
커스텀 HTML 요소
If you render a tag with a dash, like <my-element>, React will assume you want to render a custom HTML element.
is 어트리뷰트를 사용하여 브라우저 내장 HTML 요소를 렌더링하면 커스텀 엘리먼트로 취급됩니다.
Setting values on custom elements
Custom elements have two methods of passing data into them:
- Attributes: Which are displayed in markup and can only be set to string values
- Properties: Which are not displayed in markup and can be set to arbitrary JavaScript values
By default, React will pass values bound in JSX as attributes:
<my-element value="Hello, world!"></my-element>Non-string JavaScript values passed to custom elements will be serialized by default:
// Will be passed as `"1,2,3"` as the output of `[1,2,3].toString()`
<my-element value={[1,2,3]}></my-element>React will, however, recognize an custom element’s property as one that it may pass arbitrary values to if the property name shows up on the class during construction:
export class MyElement extends HTMLElement { constructor() { super(); // The value here will be overwritten by React // when initialized as an element this.value = undefined; } connectedCallback() { this.innerHTML = this.value.join(", "); } }
Listening for events on custom elements
A common pattern when using custom elements is that they may dispatch CustomEvents rather than accept a function to call when an event occur. You can listen for these events using an on prefix when binding to the event via JSX.
export function App() { return ( <my-element onspeak={e => console.log(e.detail.message)} ></my-element> ) }
모든 SVG 컴포넌트
React는 브라우저에 내장된 모든 SVG 엘리먼트를 지원합니다. 이는 다음과 같은 것을 포함합니다.
<a><animate><animateMotion><animateTransform><circle><clipPath><defs><desc><discard><ellipse><feBlend><feColorMatrix><feComponentTransfer><feComposite><feConvolveMatrix><feDiffuseLighting><feDisplacementMap><feDistantLight><feDropShadow><feFlood><feFuncA><feFuncB><feFuncG><feFuncR><feGaussianBlur><feImage><feMerge><feMergeNode><feMorphology><feOffset><fePointLight><feSpecularLighting><feSpotLight><feTile><feTurbulence><filter><foreignObject><g><hatch><hatchpath><image><line><linearGradient><marker><mask><metadata><mpath><path><pattern><polygon><polyline><radialGradient><rect><script><set><stop><style><svg><switch><symbol><text><textPath><title><tspan><use><view>