본문 바로가기
반응형

TIL/react4

React PropTypes 타입 검사 PropTypes는 전달받은 데이터의 유효성을 검증하기 위해서 다양한 유효성 검사기(Validator)를 내보냅니다. 아래 예시에서는 PropTypes.string을 사용하게 될 것입니다. prop에 유효하지 않은 값이 전달 되었을 때, 경고문이 JavaScript 콘솔을 통해 보일 것입니다. propTypes는 성능상의 이유로 개발 모드(Development mode) 에서만 확인될 것입니다. https://ko.reactjs.org/docs/typechecking-with-proptypes.html PropTypes와 함께 하는 타입 검사 – React A JavaScript library for building user interfaces ko.reactjs.org 타입 검사 방법 모든 타입 Pro.. 2022. 3. 14.
React 프로젝트 생성 CRA(Create-React-App) vscode - 터미널 - 새터미널 ctrl + ~ : 터미널 열기 ​ CRA(Create-React-App) : 리액트 프로젝트를 시작하는데 필요한 개발 환경을 세팅 해주는 도구 ​ https://create-react-app.dev/docs/getting-started Getting Started | Create React App Create React App is an officially supported way to create single-page React create-react-app.dev ​ npx create-react-app 프로젝트명 / yarn create react-app 프로젝트명 cd 프로젝트명 npm start or yarn start - 실행 ​ CRA 명령어 Create.. 2022. 3. 13.
VS Code 리액트 자동완성 플러그인 추천 Reactjs code snippets rsc : 함수형 컴포넌트 자동생성 import React from 'react'; const Test2 = () => { return ( ); }; export default Test2; rcc : 클래스형 컴포넌트 자동생성 - 요즘엔 잘 사용하지 않는다고 함 2022. 3. 6.
React를 위한 ES6 문법 1. let / const 2. 템플릿 리터럴(Template literal) 새로운 문자열 표기법 3. 삼항연산자와 &&연산자, ||연산자 4. 화살표함수 5. 배열 6. map https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/map arr.map(callback(currentValue[, index[, array]])[, thisArg]) 매개변수 callback 새로운 배열 요소를 생성하는 함수. 다음 세 가지 인수를 가집니다. currentValue 처리할 현재 요소. index Optional 처리할 현재 요소의 인덱스. array Optional map()을 호출한 배열. thisArg Opt.. 2022. 3. 6.
반응형