Notice
Recent Posts
Recent Comments
Link
250x250
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 의존성문제
- git lab clone
- node 오류
- npm start
- owlcarousel
- googleicon
- fontawesome
- maxwidth
- 글자들여쓰기
- package.json
- slickslider
- minwidth
- XEIcon
- 동적객체
- npm install
- 이미지반응형
- legacy-peer
- Git clone
- vscode git clone
- 플러그인
- node설치
- MediaQuery
- 단어단위로떨어지기
- npm install 문제
- 그누보드반응형
- window 정책변경
- react npm install
- 웹아이콘
- 아이콘사용법
- 정적객체
Archives
- Today
- Total
어쩌다 알게 된 ƪ(•̃͡•̃͡ ƪ
리액트 훅 정리 본문
728x90
** redirect
=> 어떤 경로에서 다른 경로로 강제 이동시키는 것
** Portal
=> <div id='portal-root'></div>을 기점으로 안에 모달, 드롭다운, 툴팁 같은 컴포넌트를 여기로 밀어 넣는 자리 표시자(anchor) 역할
📁 index.html
<div id='portal-root'></div>
📁 Portal.js
const Portal = ({ id = 'portal-root', children }) => {
const { fullScreenStatus } = useContext(ThemeContext);
const mount = document.getElementById(id);
if (fullScreenStatus) return children;
return ReactDOM.createPortal(children, mount);
};
Portal.propTypes = {
children: PropTypes.node.isRequired,
id: PropTypes.string,
};
42
39
34
21
17
728x90
Comments
