[Web] React Custom Tag

Web 2018. 4. 3. 23:08

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



WRITTEN BY
hojongs
블로그 옮겼습니다 https://hojongs.github.io/