jeonghwan-kim / jeonghwan-kim.github.com

김정환 블로그 코드 저장소 입니다.
https://jeonghwan-kim.github.io/
BSD Zero Clause License
41 stars 9 forks source link

2022/05/28/react-high-order-component #285

Closed utterances-bot closed 2 years ago

utterances-bot commented 2 years ago

리액트 고차 컴포넌트(HOC) | 김정환 블로그

https://jeonghwan-kim.github.io/2022/05/28/react-high-order-component

zereight commented 2 years ago

Hoc라 하면

<HocWrapper>
  <Content/>
</HocWrapper>

형태만 생각했었는데, redux의 connect나 router처럼 export할 때 감싸는 것들도 Hoc라고 할 수 있군요!

displayName 팁이랑 주의사항도 감명깊게 읽었습니당

좋은글 감사합니다 🙏

jeonghwan-kim commented 2 years ago

@zereight 리액트 기능이라기 보다는 일종의 패턴이라서 정의에 맞으면 hoc라고 부를수 있을것 같아요.

고차 컴포넌트는 컴포넌트를 가져와 새 컴포넌트를 반환하는 함수입니다.

geunheejung commented 1 year ago

좋은 글 감사합니다:)

jeonghwan-kim commented 1 year ago

@geunheejung 감사합니다.