본문 바로가기

Typescript & React

useHistory에서 새로고침이 되지 않을 때 해결방안

728x90

보통 const history  = useHistory history.push('/') 이렇게 사용한다. 

그런데 새로고침이 되지 않되는 경우가 있다. 이럴 때 일단 기능 구현을 위해서 javascript에서 사용하는 location.href = "/" 를 사용하자 그런데! typescript에서는 window.location.href = " /  " 이렇게 사용해야된다.

728x90

'Typescript & React' 카테고리의 다른 글

Typscript 문법 오류  (0) 2024.06.14
React에서 react-hook-form 새로고침 문제 해결 방법은?  (0) 2024.06.12
SyntaxError: Unexpected end of JSON input  (0) 2024.02.15
this의 이해  (1) 2024.01.21
never type  (0) 2024.01.02