codingPpushu's dev story

Ever tried. Ever failed. No matter. Try Again. Fail again. Fail better.

0%

TIL-210510

What?

React Project - Shop
Ajax component 중첩시 state 전달 state 조작법 Context API
react-transition-group
  • 리액트에서의 Ajax
    • 서버에 새로고침없이 요청 할 수 있게 도와주는 코드
      • axios 라이브러리 설치
      • 더보기 버튼 구현 (클릭시 상품 데이터 가져온 후 메인페이지 하단에 추가)
  • component 중첩시 state 전달
    • component1 => component2 => component3 (props 문법을 두 번 써주면 됨)
  • state 조작법
    • 사본을 만든다.
    • 사본을 변경한다.
    • 사본을 변경 함수에 넣는다.
  • Context API
    • props 연속 사용이 싫다면 사용
  • react-transition-group
    • 컴포넌트 등장/업데이트시 transition 쉽게 줄 수 있음