뒤로
준프
준프 ·

리액트 Custom Hook과 Context API

지겨울 만도 하지만 다시 나타난 Custom Hook과 Context API에 관한 글 입니다. 하지만 그럼에도 좋은 글이라고 생각해서 공유 합니다. 왜냐하면 사랑에 대한 글과 문장은 많지만 울림을 주는 경우는 많지 않고 명문은 더욱 적은 것과 비슷하다고 할까요?

종종 설명을 하다보면 장황하게 설명할 때가 많은데요, 이 글은 Custom Hook과 Context API가 리액트 앱에서 어떤 역할을 하는지, 언제 사용하면 좋을지 아주 간결하고 명확하게 설명합니다.

Custom hooks are functions that allow you to extract and share stateful logic across multiple components. They allow you to encapsulate state and behavior in a reusable, modular, and testable way. The Context API, on the other hand, provides a way to pass data down the component tree without having to pass props down manually at every level.

그리고 장점과 단점도 명확하게 나열되어 있습니다. 그 중에 특히 단점이 눈에 들어왔습니다.

  • Complexity: While custom hooks and the Context API are very powerful, they can also add a layer of complexity to your code, making it more difficult to understand and maintain.

글이 길지 않기 때문에 읽기도 좋네요 :)

0

댓글

로그인 후 댓글을 남길 수 있습니다.

Hyunsol Park
Hyunsol Park

안그래도 context api에 대해서 고민했는데 감사합니다 ㅎㅎ