flicking - cannot be given 에러

Jake_Young·2022년 4월 29일
0

에러 내용

Warning: Function components cannot be given refs.
Attempts to access this ref will fail.
Did you mean to use React.forwardRef()?

Check the render method of `StrictPanel`.
    in JSXStyle (created by StrictPanel)
    in StrictPanel (created by Flicking)
    in div (created by Flicking)
    in div (created by Flicking)

시도

  1. 기존 팀원이 작성했듯이 forwardRef를 추가한다.
    • 근데 팀원은 왜? 무슨 근거로 이를 추가했을까?
  2. 팀원이 작성한 forwardRef를 제거한다.
    • 에러가 두 개로 늘어났다.
    • 그래서 다시 추가하면 하나로 줄어든다.
    • 어딘가 빼놓은 게 있는 것 같으니 그걸 찾아본다.
  3. 갑자기 해당 library의 github issues를 뒤져보았다.

해결

  • forwardRef 대신 useFindDOMNode를 사용하여 해결!
  • 하지만 아래와 같은 새로운 에러가?!
  • 이거 해결하러 다시 가즈아~

profile
자바스크립트와 파이썬 그리고 컴퓨터와 네트워크

0개의 댓글