환경설정
- node.js cmd or 홈페이지에서 다운로드 후 설치.
참고 : https://gocoder.tistory.com/2167 [고코더 IT Express]
- npm install npx -g로 NPX 설치.
- git 설치 및 chrome React Developer Tools 확장 프로그램 설치.
- npx create-react-app 폴더명으로 react 개발 환경 구축
- publick - index의 불필요한 내용 삭제 및 src폴더에 불필요한 파일 삭제
중요사항
- noscript안에 작성되어 있는 부분은 자바스크립트가 실행되지 않을 때 나오는 것.
- 리액트는 MVC 중 View 역할을 담당한다고 볼 수있다.
- props 전달하는것이 Controller에 해당.
- props의 type을 검사하기 위해 prop-types를 설치하고 아래와 같이 검사할 수 있음.
Food.propTypes = {
propsId : PropTypes.number.isRequired,
propsName : PropTypes.string.isRequired,
propsImage : PropTypes.string
}