뉴히의 개발 로그
[TIL] 20230828 - 오류 + 오류 + 오류ㅠㅠㅠㅠㅠㅠ !!!!!!!!!! slide custom 오류 react-dom.development.js:86 Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? 본문
개발일지/TIL
[TIL] 20230828 - 오류 + 오류 + 오류ㅠㅠㅠㅠㅠㅠ !!!!!!!!!! slide custom 오류 react-dom.development.js:86 Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
뉴히 2023. 8. 28. 22:32오류 1
react-dom.development.js:86 Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
함수형 컴포넌트가 직접적으로 ref를 사용할 수 없다는 것을 나타냅니다. ref를 사용하려면 함수형 컴포넌트를 React.forwardRef()로 감싸야 합니다.
예를 들어, ProfilesCard 컴포넌트를 React.forwardRef()로 래핑하여 ref를 사용할 수 있게 만들 수 있습니다.
const ProfilesCard = ({ tutor }: pageProps) => {}
==>
const ProfilesCard = React.forwardRef<HTMLDivElement, ProfilesCardProps>(
({ tutor }, ref) => {})
오류2
Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
참고로 해당오류는 라이브러리 사용시 container / wrapper / slide 이런 순서대로 안해줫을때 나타나는 오류라고한다.
공식문서를 잘 보고 라이브러리 사용을 제대로 해야겠다.
custom 하려다가 시간을 엄청 잡아먹음 !
'개발일지 > TIL' 카테고리의 다른 글
[TIL]20230830 - GET, POST 개념과 방식의 차이점, 데이터 흐름 (0) | 2023.08.30 |
---|---|
[TIL][CS] 20230829 - 브라우저는 어떻게 동작하는가? (0) | 2023.08.29 |
[TIL] 20230825 - typescript '{ created_at: string; id: string; matching: boolean | null;...}' 형식에 'filter' 속성이 없습니다. (0) | 2023.08.25 |
[TIL] 20230823 - 비동기 함수와 dispatch : 로그인 사용자 정보 리덕스 툴킷으로 보내기 (0) | 2023.08.24 |
[TIL] 20230822 - useEffect의 실행 순서 (0) | 2023.08.22 |