-
class 내부 메서드에서 화살표 함수를 사용한다면Front-end/Javascript 2022. 5. 12. 01:18
[ 1 ] constructor 메서드 내부에서 화살표 함수를 사용하여 속성을 추가했을때.
결과 :
[ 2 ] 클래스 내부의 메서드를 화살표 함수로 작성했을때.
결과 : babel class properties transform 변환시 생성자 constructor 메서드 내부의 속성으로 이동한다.
참고 :
https://babeljs.io/docs/en/babel-plugin-proposal-class-properties
Arrow Functions in Class Properties Might Not Be As Great As We Think
Since the last year, the Class Properties Proposal simplify our life, especially in React with the internal state , or even with statics…
medium.com
'Front-end > Javascript' 카테고리의 다른 글
Lexical 🤪 (0) 2022.09.07 자바스크립트의 메모리 관리 (0) 2022.06.29 화살표함수와 this (0) 2022.04.30 클래스 (3) (0) 2022.04.29 클래스 (2) (0) 2022.04.29