참고 사이트 _ 리액트 공식 홈페이지
https://reactjs.org/docs/components-and-props.html
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
class Welcome extends React.Component {
render() {
return <h1>Hello, {this.props.name}</h1>;
}
}
부모요소에서 자식 컴포넌트로 데이터를 보낼 때
<SimpleSlider className={style.store} stores={storeList} />
const stores = this.props.stores;
처음에 this.stores를 찍으니 안먹혀서 공식 홈페이지에 예시를 보니 함수형에서는 함수 파라미터로 props를 받아서 사용하고 클래스형에서는 그냥 바로 this.props.넘겨준 변수명 으로 사용을 하면 되었다.
공식 홈페이지를 잘 보자... 가장 신뢰할 수 있는 정보!!