- react에서 props들은 top-down 방향으로 단방향 전달만이 가능하다.
예를 들어, Apps.js에서 아래와 같은 코드가 존재하면 name과 age라는 props들은 해당 App.js로 import된 components으로만 전달이 가능하다.
function App() {
return <Something name="Dam" age={22} />
}
즉, App.js is the parent and Something.js is the child, and the props can be read in the Something.js component.
전달된 props들은 immutable하고, 오직 parent component에서 전달해주는 것에 rely 한다.
'JavaScript > React' 카테고리의 다른 글
2023.08.30 react 공부 정리 (0) | 2023.08.30 |
---|