Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- React
- map()에는 key값이 필요
- 리스트랜더링
- 오공완
- 리액트
- 클래스 추가하기 #특정 url 클래스 추가 #사이트 접속시 클래스 추가 #오공완 #javascript
- 오공완 #리액트 공부 #React
Archives
- Today
- Total
new_bird-hyun
React의 고급 패턴 - HOC(High-Order Components) 본문
import React from 'react';
// HOC 정의
function withLogging(WrappedComponent) {
return function EnhancedComponent(props) {
console.log(`Component Rendered with props:`, props);
return ;
};
}
// HOC 사용
function Button({ label }) {
return ;
}
const LoggingButton = withLogging(Button);
function App() {
return ;
}
export default App;
'코딩 공부' 카테고리의 다른 글
React의 상태 관리 심화 - useContext와 useReducer의 조합 (0) | 2024.12.14 |
---|---|
React의 useRef 활용법 (1) | 2024.12.13 |
React의 상태 관리 - Context API vs Redux (0) | 2024.12.11 |
React의 고급 패턴 - Render Props (1) | 2024.12.10 |
React의 고급 패턴 - Compound Components (1) | 2024.12.09 |