React
현재 경로에 React 설치 1. 터미널에 들어가서 install npm 2. npm install -g yarn 3. npm install -g create-react-app 4. create-react-app client
React 시작 1. cd client 2. yarn start해서 React 서버 실행
Component 사용방법
        import React, {Component} from 'react';
        class R003_ImportComponent extends Component{
          render(){
            return (
                

[This is Imported Component]

) } } export default R003_ImportComponent
생명주기 함수
          constructor는 가장 먼저 실행되며, 처음 한 번만 호출된다.
          static getDerivedStateFromProps(props, state)는 constructor다음으로 실행된다.
          
          componentDidMount는 제일 마지막
  constructor(props){
    super(props);
    this.state = {};
    console.log('1. constructor Call');
  }
  static getDerivedStateFromProps(props, state){
    console.log('2. getDerivedStateFromProps Call : '+props.prop_value);
    return {tmp_state:props.prop_value};
  }
  render(){
    console.log('3.render Call');
    return (
      

[This is CONSTRUCTOR FUNCTION]

) } componentDidMount(){ console.log('4. componentDidMount Call'); console.log('5. tmp_state : '+this.state.tmp_state); }
Contact
  • Address : 서울특별시 서대문구 북아현로22길 18 (힐사이드빌) 302호
  • E-mail : june3004@naver.com
  • Tel : 010-5886-9393
  • 이 페이지는 프로필, 일기장, 정보공유, 공부 포트폴리오로 만들 예정입니다.