[React] destroy is not a function

masibasi·2023년 5월 4일
0

react troubleshooting

목록 보기
4/7


https://medium.com/geekculture/react-uncaught-typeerror-destroy-is-not-a-function-192738a6e79b!


왜냐하면 , “One feature of the useEffect hook is a cleanup function. If you return anything from the useEffect hook function, it must be a cleanup function. This function will run when the component unmounts. This can be thought of as roughly equivalent to the componentWillUnmount lifecycle method in class components.”

Async가 리턴하는것은 항상 Promise이다. 그러므로 충돌이 나는것.

결국 async를 이렇게 함수로 밖으로 빼는것이 맞다

0개의 댓글