본문 바로가기 메뉴 바로가기

cs09g 블로그

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

cs09g 블로그

검색하기 폼
  • 분류 전체보기 (61)
    • Git (10)
    • Open source (2)
    • 프론트엔드 (16)
    • Javascript (15)
    • Mozilla (0)
    • 개발환경 (13)
      • Windows (4)
      • Linux (5)
      • Mac (3)
    • 생각 (3)
    • 여행 (1)
  • 방명록

react (2)
[React] 이벤트 핸들러로 파라미터 전달하기

1. this 바인딩과 함께 전달 class MyComponent extends React.Component { myMethod(param, e) { console.log(param); // 'someParam' console.log(e); // SyntheticEvent } render() { return ( {/* this 바인딩과 함께 전달 */} ); } } 2. arrow function 활용 class MyComponent extends React.Component { myMethod(param, e) { console.log(param); // 'someParam' console.log(e); // undefined } render() { return ( {this.myMethod('some..

프론트엔드 2020. 10. 28. 23:00
[React] 이벤트 핸들러에서 this 사용하기

1. 생성자에서 핸들러에 this를 바인딩 class MyComponent extends React.Component { constructor() { this.state = { someState, }; this.myMethod = this.myMethod.bind(this); // this 바인딩 } myMethod() { this.setState({someState: 'another state'}); } render() { return ( ); } } 2. 핸들러 등록과 함께 this를 바인딩 class MyComponent extends React.Component { constructor() { this.state = { someState, }; } myMethod() { this.setState(..

프론트엔드 2020. 10. 27. 00:18
이전 1 다음
이전 다음
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
링크
  • Firefox
  • Mozilla Hacks Korea
TAG
  • no_fcp
  • getter
  • event
  • writeStream
  • nodejs
  • Mac
  • GIT
  • 크롬
  • 사이트성능측정
  • bouncscroll
  • fetch
  • git-checkout
  • 블랙스크린
  • ubuntu
  • JavaScript
  • csv-parser
  • chrome
  • abortcontroller
  • react
  • setter
  • Android
  • Windows
  • bigsur
  • readStream
  • testing
  • Safari
  • ios
  • 리소스모니터
  • Karma
  • git-tag
more

Blog is powered by Tistory / Designed by Tistory

티스토리툴바