-
[React] Warning: react-modal: App element is not defined. 해결ETC/트러블슈팅 2023. 1. 19. 12:25
페이지에서 모달을 띄우기 위해 react-modal 라이브러리를 이용할 경우,
warning.js:34 Warning: react-modal: App element is not defined. Please use `Modal.setAppElement(el)` or set `appElement={el}`. This is needed so screen readers don't see main content when modal is opened. It is not recommended, but you can opt-out by setting `ariaHideApp={false}`.
이런 에러를 만날 수 있다
해결방법
ariaHideApp={false}
ReactModal 태그 속성에 ariaHideApp={false} 를 추가해주면 된다
<ReactModal ariaHideApp={false} isOpen={modalOpen} onRequestClose={() => setModalOpen(false)} style={{ overlay: { position: 'fixed', background:'rgba(0, 0, 0, 0.3)'}, content: {margin: 'auto', width: '815px', height: '495px'}}} > 모달 내용 </ReactModal>
'ETC > 트러블슈팅' 카테고리의 다른 글
[React] Uncaught TypeError: Assignment to constant variable 해결 (0) 2022.07.20 [React] TypeError: window.location.href is not a function 해결 (0) 2022.07.19 [React] POST 415 (Unsupported Media Type) error 해결 (0) 2022.07.17 [React] TypeError: Cannot read properties of undefined (reading 'substring') 해결 (0) 2022.07.13