Component class를 extend해서 custom tag를 만들수도 있지만
단순히 function(class의 method 조차도)도 custom tag로 사용할 수 있다
Component의 render()를 정의하듯, function이 JSX를 return하면 된다
Test = () => (<p>test</p>);
// in render(), you can use
<Test />
다른 주제의 문서이지만, 아래 문서를 보다가 알게되었다
https://reactjs.org/docs/conditional-rendering.html
'Web' 카테고리의 다른 글
[Web] react - props, defaultProps, 상속 (1) | 2018.04.04 |
---|---|
[Web] Javascript undefined vs null (0) | 2018.04.03 |
[Web] javascript comarison operator (python과 다른 부분) (0) | 2018.04.03 |
[Web] HTML 자주사용하는 Tag(Element) List (0) | 2018.04.03 |
[Web] Error: 'React' must be in scope when using JSX (0) | 2018.04.03 |
WRITTEN BY
- hojongs
블로그 옮겼습니다 https://hojongs.github.io/