Decorators for ES6 Classes Proposal (Mostly) Reaches Stage 3 at TC39
— We first linked to this proposal three years ago but it’s now conditionally made it to stage 3 (with some tweaks required) and people are very excited. Despite dating from 2019, Mike Green’s explanation of the idea remains a good accessible overview of the basic idea, if the proposal feels too technical.
⇒ ☝🏻 TC39는 ECMA script를 관리하는 표준 위원회다.
stage 2.단계는 초고 단계인데 decorators가 stage 3에 도달했음은 곧 초고가 끝나고 완성에 가까워졌기 때문에 ES 버전에 도입되어 정식 기능이 된다는 말이겠지! 이전까지는 Babel을 거쳐서 사용했는데, 정식 기능이 된다면 이미 사용해버린 데코레이터를 수정하거나 babel의 데코레이터 플러그인을 레거시 모드로 계속 사용해야 하기 때문에 비용이 발생 할 수 있겠다.
☝🏻 TC39 구성원은 Mozilla, Google, Apple, MS, Facebook, Twitter등 메이저 그룹 등 다양하게 이루어져 있다.
엄청난 대기업들이 구성원이라니.. 먼나라 이야기 같다. 하지만 모든 회의록과 진행상황이 전부 GitHub를 통해 공유되고 있고 조회가 가능하다. 때문에 누구든지 챔피언(제안하고자 하는 proposal을 끌고 나갈 TC39구성원)을 구해서 proposal를 제출하거나 의견을 낼 수 있다!
☝🏻 Proposal-Decorators 에 대해서 자세한 내용을 확인해보라. (한글 설명은 여기 또는 여기)
데코레이터는 클래스에서 호출되는 함수이고 단어 그대로 ‘장식'해준다는 기능이다. 서로 관련 없는 클래스 사이의 동작 공유를 단순화 시킬 수 있기 때문에(랩핑) 상당히 도움이 되는 도구 중 하나이다.
@+decorator 함수
식으로 사용한다.
@defineElement("my-class")
class C extends HTMLElement {
@reactive accessor clicked = false;
}
☝🏻 Decorators 주요한 세 가지 기능 :
— The plan was for v18 to be an easy upgrade even if there were many changes under the hood.. and despite the introduction of a new concurrent renderer, Suspense, new hooks, automatic batching, and more, they’ve done a great job keeping the ship steady.
The React 18 upgrade guide covers some things you need to consider, and if you’re a completist, the change log digs deep.
한글버전으로 아주 요약이 잘 되어있는 포스트 공유!