Web/React

[React] React props

MINWOOJ 2021. 5. 17. 07:02

React props는 부모 component에서 자식 component에게 데이터를 넘겨줄때 사용한다.

 

props에는 여러 종류의 method가 있는데 부모에서 넘겨주는 값 이외에 children, deafaultProps가 있다.

 

children은 "<자식 component>Children 데이터</자식 component>" 로 tag로 감싸진 부분의 데이터이다.

 

default props는 props의 값을 주지 않을 경우에도 자동으로 props의 값을 주고 싶을때 사용한다.