-
1. React에서 이벤트 위임을 해준다.
<17
: React doesn't attach your click event handlers to the nodes.
It uses event delegation and listens at the document level.>=17
: Delegate events to roots instead of document.
2. RORO(Receive an object, return an object) 패턴
사용하는 이유
- Named parameters
- Cleaner default parameters
- Richer return values
- Easy function composition
예시
/** * Named Parameters */ // 1. function receive three parameters function findUsersByRole ( role, withContactInfo, includeInactive) {...} // call findUsersByRole( 'admin', true, true) // 2. function receive a single object function findUsersByRole ({ role, withContactInfo, includeInactive }) {...} // call findUsersByRole({ role: 'admin', withContactInfo: true, includeInactive: true }) // call with re-ordered parameters findUsersByRole({ withContactInfo: true, role: 'admin', includeInactive: true }) // call with omitted parameters findUsersByRole({ role: 'admin', includeInactive: true })
'log > Memo' 카테고리의 다른 글
쿼리키 관리, 커스텀훅 (0) 2022.10.25 Quick Select, Husky (0) 2022.07.31 최소 맨해튼 거리, 배열에서 K번째 원소 찾기 (0) 2022.07.26 댓글